The Board of Control for Cricket in India (BCCI), in a release, said Kohli will be monitored by the medical team during the proceedings in the second Test.
"Team India captain Mr Virat Kohli had a spasm on his upper back this morning. He won't feature in the second Test against South Africa at The Wanderers. The BCCI medical team will be monitoring him during the course of this Test match. KL Rahul will captain the side in his absence," said the BCCI.
It also meant that Kohli's milestone of playing his 100th Test won't be coming at the Newlands in Cape Town, which had been presumed for long. According to India's schedule, if all goes well, then Kohli might play his 100th Test at the M Chinnaswamy Stadium in Bengaluru, where the first Test against Sri Lanka is scheduled for February 25.
Rahul, when asked about Kohli's absence at the toss, had hoped that he would be available for the final Test at Cape Town from January 11.
"Unfortunately, Virat is having an upper back spasm. The physios are working on him and hopefully he will recover in time for the next Test."
Earlier, Rahul had been appointed as the ODI skipper in Rohit Sharma's continued absence due to a left hamstring injury sustained before leaving for the Rainbow Nation.
Sharma's injury meant Rahul was the deputy to Kohli for the Test series.
The BCCI also said pacer Jasprit Bumrah will be serving as Rahul's deputy for the second Test. Bumrah had been appointed as the vice-captain for the ODI series, which will begin after the Test series ends.
"The All-India Senior Selection Committee has named Jasprit Bumrah as vice-captain for the 2nd Test."
In place of Kohli, Hanuma Vihari was given the opportunity to be in the playing eleven, leaving people wondering where Shreyas Iyer was.
The BCCI said that Iyer wasn't available for selection due to a stomach bug. "Team India batsman Shreyas Iyer was also ruled out of selection for the 2nd Test owing to a stomach bug."