In Cape Town, the authorities and charities launched a campaign to feed and shelter the displaced.
At least 10,000 immigrants fled to makeshift camps outside the south-western city alone.
On Sunday, one Cape Town township pledged to reintegrate foreigners as soon as possible and recover items looted from shops.
"We must go and receive that stuff and we must bring back the Somali shopkeepers as speedily as possible as they are of good service to the community," one resident told the BBC.
South African President Thabo Mbeki made his comments in a national radio and television address.
He said the attacks were the worst acts of inhumanity South Africa had seen since the end of apartheid.
"Sadly here in South Africa we mark Africa Day with our head bowed," he said.
"The shameful actions of a few have blemished the name of South Africa through criminal acts against our African brothers and sisters from other parts of the continent as well as other foreign residents especially from Asia."
The president has been criticised for his handling of the crisis, including a response which some have seen as slow.
The BBC's Will Ross in Johannesburg says some in South Africa wonder why it took him two weeks to make this address to the nation.
South African police raiding the home of a suspect
Earlier, he promised to launch an investigation into the attacks.
One critic, Moeletsi Mbeki - the president's own brother - has said the violence is the result of failed foreign and immigration policies.
Our correspondent says there is a great deal of xenophobia in South Africa and foreigners are often accused of taking away people's jobs and fuelling crime.
But despite this perception, he adds, most South Africans have been utterly appalled by the violence.
The troubles flared with a wave of attacks on foreigners in the township of Alexandra, within sight of some of Johannesburg's most expensive suburbs.
They have since spread to seven of South Africa's nine provinces.
In Johannesburg, the ANC said party officials were fanning out to community halls and stadiums across the city in what it called a "programme of engagement" to stem the tide of violence.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.