President Cyril Ramaphosa on Sunday said South African would close its borders from Wednesday to all foreigners from countries highly impacted by the coronavirus pandemic.
Visas will be refused to anyone who has visited a high-risk country in the last 20 days, and 35 of the country's 53 land ports will also be shut as of Monday.
"We are imposing a travel ban on foreign nationals from high-risk countries such as Italy, Iran, South Korea, Spain, Germany, the United States, the United Kingdom and China from 18 March 2020," Ramaphosa said in an address to the nation.
The president also announced the closure of schools for around three weeks from Wednesday.
Public gatherings of more than 100 people will be been banned and mass celebrations cancelled to limit contact.
"Given the scale and the speed at which the virus is spreading, it is now clear that no country is immune from the disease or will be spared its severe impact," said Ramaphosa, who declared a "national state of disaster".
To date 61 people in South Africa have tested positive for novel coronavirus -- the second-highest number of cases in Africa after Egypt, which has reported 110 so far.
The number of infections more than doubled over the weekend with 37 new cases announced.
Around 50 of South Africa's coronavirus patients had recently travelled abroad.
Most came from Europe, the new epicentre of the virus, while others had returned from the United States and the Middle East.
But Ramaphosa suggested the latest confirmed cases had contracted the virus in South Africa.
"Initially, it was people who had travelled out of the country, especially from Italy," he said.
"It is concerning that we are now dealing with internal transmission of the virus."
Sub-Saharan Africa has so far escaped the worst of the pandemic, which has infected more than 160,000 people worldwide and killed over 6,000.
The region has recorded just over 100 cases in more than 20 countries, almost all of which were imported from the West.
But numbers have been creeping up fast, prompting several African leaders to roll out measures to limit infections.
Kenya blocked entry to all except citizens and residents on Sunday as the number of confirmed cases rose to three.
Governments across the continent have banned public gatherings, shut schools and restricted travel from areas hit by the pandemic.
South Africa's new measures are bad news for tourism, which is a major foreign exchange earner and contributes to 10 percent of GDP.
The industry already suffered a blow after Beijing blocked overseas tours from China, where coronavirus was first detected in December.
"These losses are still going to increase," Tourism Minister Mmamoloko Kubayi-Ngubane warned last week, when travel bans had not yet been implemented.
"Whatever happens, the truth of this situation is the virus will have a negative impact on the tourism sector."
More than half the tourists that visited South Africa from overseas in December came from Europe, according to government statistics, followed by the US and Asia.