The men were in the shop in Umlazi, south of Durban, when it was petrol bombed on Friday night.
"The two Somali men suffered severe burn wounds and are being treated in hospital," police spokesman Thulani Zwane said.
Zwane said three people including one foreigner had been killed so far -- two on April 5 and a third on Friday -- in violence between residents and foreign nationals that has been raging for the past two weeks in townships south of Durban.
"The situation is still tense in all affected areas, and police are out in force to prevent further clashes," Zwane said.
Police said 17 people had been arrested for various acts of violence in the eastern port city.
The violence has seen over a thousand mostly African foreign nationals flee their township homes.
Several mini grocery shops owned by foreign nationals in Isipingo and Chatsworth, where the unrest began two weeks ago, had been looted and vandalised.
Clashes had now also spread to KwaMakhutha and Umlazi, also in the south of Durban.
Those fearing violence and intimidation who had fled their homes were currently being housed in community halls and tents pitched in sports grounds.
Police on Wednesday broke up an illegal march by a group of foreign nationals who were protesting against the violence, firing water canon and tear gas.
Clashes between immigrants and locals often flare in South Africa, as impoverished residents accuse them of taking their jobs.
Foreign business owners in black townships are increasingly under attack from local residents.
Early this year, foreign shopkeepers in and around Soweto, south of Johannesburg, were forced to vacate their premises after violence and looting broke out.
In 2008, 62 people were killed in Johannesburg townships.