US President Barack Obama is due to tour Robben Island – the jail in which Nelson Mandela was kept for 18 years.
The trip comes a day after Mr Obama visited members of the family of the 94-year-old former president, who remains critically ill in hospital.
Mr Obama paid tribute to the impact of the anti-apartheid leader in building a free South Africa, describing him as “an inspiration to the world”.
Later, riot police clashed with anti-Obama protesters in Soweto.
Security is likely to be strengthened during this final Cape Town leg of his time in South Africa, says the BBC’s Karen Allen who is there.
The US leader did not visit Mr Mandela, but met the Mandela family in private and spoke by telephone to his wife, Graca Machel.
Mr Mandela remains in critical condition. On Sunday South Africa’s last apartheid president and the man jointly awarded the 1993 Nobel Peace Prize with Mr Mandela, FW de Klerk, will return to South Africa after cutting short a visit to Europe due to Mr Mandela’s poor health.
The visit by Mr Obama and the first family to Robben Island is likely to be the most poignant moment of the president’s Africa tour, our correspondent says.
Mr Mandela was held there for 18 years and his long history of lung problems can be traced to the tuberculosis he contracted there – which he attributed to the dampness of his cell.
Mr Obama will also visit a community project before delivering a keynote address at the University of Cape Town.
It is the same venue where 47 years ago, US Senator Robert Kennedy gave his famed “ripple of hope” speech, which gave inspiration to those fighting the racially divisive policies of apartheid rule and linked their struggle with that of the US civil rights movement.
Mr Obama is expected to pay tribute to South Africa’s achievements over the past two decades but is expected to stress that more needs to be done to tackle poverty and disease, and strengthen democracy across the continent.
He is also due to announce a $7bn (£4.6bn) five-year initiative to double access to electricity in sub-Saharan Africa, in partnership with African countries and the private sector.
Mr Obama has been faulted for lacking a grand programme and many Africans have been disappointed at what they see as his lack of engagement with the continent, despite his African ancestry.In Pretoria on Saturday, Mr Obama said Mr Mandela’s example of “the power of principle, of people standing up for what’s right continues to shine as a beacon”.
Later, riot police fired rubber bullets and stun grenades at scores of protesters in Soweto, once a flashpoint in the anti-apartheid struggle.
At least one person was injured and one arrested.
“People died in Libya, people are still dying in Syria… in Afghanistan, in Pakistan, drones are still killing people. So that’s why we are calling him a Hitler. He’s a killer,” Ramasimong Tsokolibane, 54, was quoted as saying by the Associated Press news agency.
Mr Obama arrived in South Africa from Senegal on Friday evening. On Monday, he will continue his African tour in Tanzania.
Mr Mandela’s family heir, Mandla, has said he will oppose a court action brought by the rest of the family, seeking to exhume the bodies of his father, Makgatho, two of Nelson Mandela’s daughters and two other relatives.
The rest of the family want the remains to be reburied in Qunu, where the former South African president wants to be laid to rest, while Mandla, an ANC MP, wants them to stay in the nearby village of Mvezo, Nelson Mandela’s birthplace, where he is building a museum dedicated to his grandfather.
This is an extremely important matter for the Mandela family, especially while he remains critically ill in hos[ital – it is one of the reasons why they held a family meeting last week.
South Africa’s Sunday Times newspaper quotes local chiefs in the area as saying that Madiba, as Nelson Mandela is known in the country, will not be at peace until this issue is resolved.
On Friday, a court granted an interim action saying the bodies could be exhumed and reburied but Mandla Mandela says he was not aware of the case until it was reported in the media and he is now opposing it.