Govindsamy Mariemuthoo, the provincial police spokesman, said: "The death toll has risen to 42 - 400 people have been arrested, and 16,000 people have been displaced."
The foreigners, most of whom fled economic meltdown in neighbouring Zimbabwe, have been blamed for an increasing crime rate in the country, as well as depriving locals of employment opportunities.
The unofficial unemployment rate in South Africa is believed to be about 40 per cent.
Morgan Tsvangirai, the Zimbabwean opposition leader, on Thursday visited the township of Alexandra, where the attacks first occurred.
He said he would try his utmost to help Zimbabweans in South Africa return to their home country.
Tsvangirai left Zimbabwe in early April after winning a first-round of presidential elections against Robert Mugabe, the president.
He was set to return last weekend to contest a run-off but pulled out at the last minute amid fears of an assassination plot.
Army 'support role'
While government officials did not give details on the specifics of the army's role, Sally de Beer, the national police spokeswoman, said they would provide a support role rather than taking over law enforcement operations.
She said: "We do not see them performing policing, but rather acting in a back up capacity."
She also said that the army had equipment "that we might need for special operations" such as helicopters.
While the violence had previously been limited to Gauteng, the province that includes the cities of Johannesburg and Pretoria, reports of looting in the eastern city of Durban and the rural Mpumalanga province have raised fears that the violence could spread to other areas.
De Beer said: "A mob of 200 were gathering on the streets carrying bottles and knobkerries [wooden clubs], busy attacking people on the streets."
|Many immigrants are now leaving the|
country, fearing for their safety [AFP]
Government officials raised the possibility that the attacks on foreigners were not spontaneous but organised, possibly for political reasons.
Four community leaders were arrested in Germiston, an area of Johannesburg, on Wednesday, on charges of incitement.
A police spokesman said: "The Germiston police have made a breakthrough in the xenophobic attacks that have plagued their area since Saturday by arresting four community leaders at [the] Dukathole informal settlement this afternoon."
According to Mozambican state media, more than 3,000 Mozambicans have fled anti-immigrant violence in South Africa and have returned home.
Jodi Kollapen, chairman of the South African Human Rights Commission, said that the authorities would face a difficult task re-integrating immigrants who had been driven from their homes.
She said: "There is no way you can re-integrate people into communities if the community remains hostile to them, and those who were evicted continue to feel insecure and intimidated about going back.
"They [the locals] will have achieved the objective of driving foreigners out of the country."