“There can be no justification for any South African to attack people from other countries,” he said on Tuesday.
Dozens of people were arrested in Johannesburg on Monday after rioters looted shops and torched vehicles.
Other African governments have issued warnings to their citizens over the violence.
Attacks on businesses run by “foreign nationals is something totally unacceptable, something that we cannot allow to happen in South Africa,” Mr Ramaphosa said in a video posted to Twitter.
“I want it to stop immediately,” he added.
Separately, the African Union (AU) issued a statement condemning the “despicable acts” of violence “in the strongest terms”.
Police fired tear gas, rubber bullets and stun grenades in an attempt to quell the unrest on Monday. The surge in violence also saw mobs target lorries that were being driven by foreign nationals.
Violence continued on Tuesday in Johannesburg’s Alexandra township.
What has the reaction been?
Nigerian President Muhammadu Buhari sent an envoy to South Africa on Tuesday to “express Nigeria’s displeasure over the treatment of her citizens”.
In a statement, the country’s high commission in South Africa described the situation as “anarchy”. The government alleges that Nigerian-owned businesses were targeted in Johannesburg and it has called on Nigerians to come forward to report what has happened to them.
Ethiopia’s embassy in South Africa has advised its citizens to close their businesses during the ongoing tension, according to Ethiopia’s state-linked Fana Broadcasting Corporate (FBC).
It also says that Ethiopians are advised to “distance themselves from any confrontation and conflict” and not go out wearing expensive jewellery.
Meanwhile, Zambia’s transport ministry has said that lorry drivers should “avoid travelling to South Africa until the security situation improves”.
The statement refers to reported attacks on foreign lorry drivers. The South African IOL news site says that there have been “numerous incidents” of vehicles being looted.