On a recent visit to four West African states, the president and the entire South African delegation were tested for Covid-19 in all countries, the statement said.
"The president also tested negative on his return to Johannesburg on 8 December."
The statement quoted Ramaphosa as saying his infection served as a warning of the importance of getting vaccinated and remaining vigilant against exposure.
"Vaccination remains the best protection against severe illness and hospitalisation," the statement said.
People who came in contact with the president were advised to watch for symptoms or get tested.
"I am very sorry to hear you tested positive for Covid-19, my brother Cyril Ramaphosa. I wish you a swift recovery. Stay strong! Together!," World Health Organization chief Tedros Adhanom Ghebreyesus tweeted.
Despite cases of Omicron being found in countries worldwide, it has not yet become fully clear if it causes more severe illness or if, or to what it extent, it can evade vaccines.
In a tentative judgement, the EU Medicines Agency said on Thursday that Omicron may cause milder disease after the WHO said earlier in the week that there was some evidence that Omicron causes less severe disease than Delta, the currently dominant variant.
More vaccinations urged
Cases of coronavirus in Africa nearly doubled over a week as omicron spread, but hospitalisations in South Africa remain low, the UN added on Thursday.
In a weekly online press briefing, the WHO's Africa branch said the continent had recorded 107,000 extra cases in the week to last Sunday, compared with 55,000 in the previous week.
Omicron "is reaching more countries in Africa", it said, adding that research was being stepped up to see whether the new variant was specifically behind the sharp rise.
The biggest surge in numbers -- 140 percent on average -- was in the south of the continent.
The agency reiterated its objections to travel restrictions, which it said had been issued by more than 70 countries and were overwhelmingly aimed at southern Africa, even though countries in the region had been "transparent with their data".
It also called on countries to step up vaccinations -- only 7.8 per cent of the continent's roughly 1.2 billion people have been jabbed.
The biggest laggards in immunisation are Chad, Djibouti and the Democratic Republic of Congo.
A new vaccine supply system is being set in place to help African countries distribute them more easily.