In a statement, it says the 69-year-old has mild symptoms and is isolating in Cape Town.
South Africa has seen a surge of infections since the new Omicron variant was first detected in November.
Despite Omicron being more transmissible than previous strains, including Delta, risk of severe disease and death is lower, a study has found.
He is the latest head of state to have contracted coronavirus - others include the UK's Boris Johnson, Donald Trump when he was US president, Brazil's Jair Bolsonaro, Emmanuel Macron of France, Czech President Miloš Zeman and Bolivia's former President Jeanine Añez.
South Africa's presidency says Mr Ramaphosa tested positive on Sunday, and has already delegated all responsibilities to Deputy President David Mabuza "for the next week".
The statement says the president started feeling unwell after attending the funeral of former President FW de Klerk early on Sunday.
It adds that Mr Ramaphosa is in "good spirits" - but is being monitored by doctors.
The statement provided no further details about Mr Ramaphosa's infection. People who have recently been in close contact with him have been asked to watch for symptoms or get tested