South African security forces began to impose a three-week national blockade in an effort to contain the spread of the coronavirus.
All movements, except the essential ones, are prohibited and the army and police are applying the measures.
Before the midnight deadline, there were long lines outside supermarkets, while people stocked up on essentials.
South Africa has registered 927 coronavirus infections – the highest in Africa – but so far no deaths.
On Thursday night, President Cyril Ramaphosa visited soldiers before being sent from a base in Johannesburg's Soweto municipality.
"I send you to defend our people against the coronavirus," he said, wearing a camouflage uniform.
"This is unprecedented, not only in our democracy, but also in the history of our country, that we will have a blockade for 21 days to go to war against an invisible enemy, the coronavirus."
Food stores may remain open, although alcohol sales are prohibited – Police Minister Bheki Cele urged South Africans to sober up during the blockade. Jogging and walking dogs are also prohibited.
On Thursday, heavy traffic on Johannesburg's main roads was reported, despite a call from the government not to make long journeys.
Thousands of people filled bus stations with the aim of escaping the capital and staying with their families in rural areas, increasing the fear that they could take the virus to older retired relatives on farms and villages.
Authorities 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," warned Defense Minister Nosiviwe Mapisa-Nqakula.
South Africa has already closed schools and banned meetings 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 could be quickly overwhelmed by a sudden increase in cases.
In South Africa, there are additional fears for people living with HIV – particularly the estimated 2.5 million in South Africa who are not taking antiretroviral drugs.