The army will be sent into the Johannesburg township of Alexandra – where a Mozambiquan immigrant Emmanuel Sithole was pictured being fatally stabbed on Saturday (18 April) – as well as areas of KwaZulu-Natal province shaken by anti-immigrant violence.
The troops will not be taking over from police in the areas, but will instead assist officers in their duties, Defence Minister Nosiviwe Mapisa-Nqakula announced.
"We come in as the last resort, the army will serve as a deterrent against the crime that we see," Mapisa-Nqakula said, not specifying how many troops would be deployed.
"There are people who will be critical but those who are vulnerable will appreciate this decision," she said.
"Now we deploying because there is an emergency."
The move follows two nights of relative peace in areas affected by the violence.
Four men have appeared in court charged with the murder of Sithole, who was pictured pleading for his life before being stabbed to death.
The men were remanded in custody, without being asked to enter a plea.
Seven have died and more than 300 people arrested after a week of violence, that broke out in Durban and spread to Johannesburg.
The South African government was accused of being slow to react to the violence, and foreign governments including China, Nigeria and Zimbabwe have criticised South Africa for failing to do enough to protect foreign citizens.
The attacks brought back memories in South Africa of the 2008 anti-immigrant attacks in the country, in which 63 people were killed.