South African security forces have begun to implement a three-week national blockade in an effort to stop the spread of the coronavirus.
All movements, except essential movements, are prohibited and both the army and the police are applying the measures.
Before the midnight deadline, there were long lines outside supermarkets as people stocked up on essentials.
South Africa has reported 927 coronavirus infections, the highest in Africa, but so far there have been no deaths.
On Thursday night, President Cyril Ramaphosa visited the soldiers before they were deployed from a base in the Soweto Township of Johannesburg.
"I send you out to defend our people against the coronavirus," he said, dressed in a camouflage uniform.
"This is unprecedented, not only in our democracy but also in the history of our country, that we will have a lockdown for 21 days to go out and wage war against an invisible enemy, the coronavirus."
Food stores may remain open although sales of alcohol are prohibited. Police Minister Bheki Cele urged South Africans to stay sober during the shutdown. Running and walking dogs are also prohibited.
On Thursday, heavy traffic was reported on major roads outside Johannesburg, despite a government call not to take long trips.
Thousands of people crowded the bus stations with the aim of escaping from the capital and staying with the family in rural areas, raising fears that they may transmit the virus to older relatives who are retired from farms and villages.
Authorities have warned that anyone who violates the rules faces six months in prison or a heavy fine.
"If people are not complying, they (the military) may be forced to take extraordinary measures," said Defense Minister Nosiviwe Mapisa-Nqakula.
South Africa has already closed schools and banned gatherings of more than 100 people.
Although Africa as a whole has not been as affected by the virus as other parts of the world, experts fear that underfunded health services on the continent may be quickly overwhelmed by a sudden surge in cases.
In South Africa there are additional fears for people living with HIV, in particular the estimated 2.5 million in South Africa who do not take antiretroviral drugs.