Kenya and Ethiopia confirmed their first cases of the new coronavirus on Friday, a woman who had returned to Nairobi from the United States and a Japanese national in Addis Ababa.
Authorities in Nairobi banned all major public events and said they would restrict foreign travel in the wake of East Africa's first reported case, while the mayor of Addis Ababa urged citizens to avoid close personal contact.
Sub-Saharan Africa has so far been less badly hit by coronavirus than Europe, China or the United States, thanks in part to rapid screening. Most of the reported cases have been in foreigners or people who had traveled abroad.
But concerns are growing about the continent's ability to handle a potential rapid spread of a virus that has infected 127,000 and killed 4,700 worldwide.
Kenya, the richest economy in East Africa and a hub for global firms and the United Nations, is the 11th country in sub-Saharan Africa to confirm a case of COVID-19, bringing the total number of reported cases to 40.
Ethiopia is Africa's second-most populous nation, with 109 million citizens. Addis Ababa, like Nairobi, is a regional transit hub.
Kenyan Health Minister Mutahi Kagwe said the government had suspended all public gatherings, sporting events, open-air religious meetings and events "of a huge public nature". Schools would remain open but inter-school events would be suspended.
Public transport operators would be required to install hand sanitizers in their vehicles and to clean them regularly, Kagwe said, while foreign travel would be restricted.
"Going forward there will be some inconveniences that citizens are going to experience," he told a news conference.
Soon after the announcement, shoppers in one Nairobi supermarket were buying up cart loads of staples like maize flour and water as well as hand sanitizers and soap.
Kagwe said the patient, a 27-year-old Kenyan, was diagnosed on Thursday after traveling home via London on March 5.
He said the government had traced most of the people she had been in contact with, including fellow passengers on her flight, and a government response team would monitor their temperatures for the next two weeks.
The Ethiopian case was a 48-year old Japanese national who arrived in Ethiopia on March 4, the health ministry said.
Health Minister Lia Tadesse said there were no plans to cancel any flights. Addis Ababa mayor Takele Uma Banti said on Twitter that people should "avoid meetings and hand contacts."
Kenya Airways suspended flights to China last month and on Thursday added Rome and Geneva to the list of suspended destinations.
Kenya, dependent on imports from China and other Asian countries, has started to feel the impact of the pandemic with disruptions to its supply chain and a decline in tourism, an important source of hard currency and jobs.
"Definitely we are going to be hit badly," Tourism Minister Najib Balala told the Nairobi news conference.