"The President of the Republic of South Africa... has accepted an invitation from his majesty the king to pay a state visit to the United Kingdom from Tuesday 22nd November to Thursday 24th November 2022," the palace said.
"The king and the queen consort (Camilla) will host the state visit at Buckingham Palace," it added, noting South Africa's first lady Tshepo Motsepe would accompany her husband on the visit.
Charles III ascended to the throne following the September 8 death of his mother, Queen Elizabeth II, the country's longest-serving sovereign.
As the UK's head of state, the monarch makes and hosts state visits with foreign royals, presidents or prime ministers.
The new king is yet to announce his first overseas visit, with reports that plans are being finalized for his travel to France after he bonded with President Emmanuel Macron over environmental issues.
State visits to Britain typically involve a ceremonial welcome on Horse Guards Parade in the heart of the capital, accompanied by gun salutes fired from Green Park and the Tower of London.
The visiting dignitaries are invited to inspect a guard of honor before traveling to Buckingham Palace in a carriage procession escorted by a large number of mounted soldiers from the Household Cavalry.
That evening, the monarch usually hosts around 150 guests — invited on the basis of their cultural, diplomatic or economic links to the country being hosted — at a grand "state banquet" in the palace's ballroom.
The sovereign makes a speech and proposes a toast to the visiting head of state, who replies and makes their own toast.
The visiting dignitary will then usually hold meetings with political leaders in the following days.
Ramaphosa last visited the UK to attend the late queen's funeral.