Eighty civilians have died this week
Somali insurgent leader Sheikh Aden Hashi Ayro has ordered fighters to attack African Union troops based in the capital, Mogadishu.
He also asked foreign fighters to join his al-Shabab group's war against the foreign forces in an audio clip posted on Somali websites.
President Abdullahi Yusuf blames the militant group for the recent violence.
Uganda has some 1,700 soldiers in Somalia as part of the planned 8,000-strong AU peacekeeping mission.
About 80 people have died this week.
The Ugandan military have dismissed the threat.
Their spokesman, Major Felix Kulaigye, said the peacekeepers will not withdraw and will defend themselves if necessary.
Al-Shabab is the militant wing of the Union of Islamic Courts, which controlled Mogadishu for six months last year before being ousted by advancing Ethiopian troops.
In Mogadishu, Ethiopian and government troops have been conducting a door-to-door search for the insurgents in the capital over the past week sparking deadly clashes.
The United Nations says some 170,000 people have fled the violence this week and hundreds others have been injured in the crossfire.
Al-Shabab's Sheikh Ayro said it was an obligation of all Muslims in Somalia to wage war against Ethiopian and Ugandan forces.
"To us the Ugandans, Ethiopians and Americans are all the same, they have invaded us and I am telling the Mujahidin [fighters], Ugandans must be one of our priorities," a tough talking Sheikh Ayro said in the audio on Dayniile website.
He said Ethiopians had failed in their mission and were now facing their worst defeat.
Last week, masked armed men in Mogadishu dragged bodies believed to be those of Ethiopian soldiers killed during clashes with the insurgent groups.
On Tuesday, President Yusuf called on Mogadishu residents to join Somali and Ethiopian troops in the fight against the al-Shabab insurgents who are living among them.
The insurgents have been targeting government and Ethiopian troops but are yet to launch attacks on the Ugandan soldiers.
The al-Shabab militant group claims to have links with Osama bin Laden's al-Qaeda network.
Last week UN secretary general Ban Ki-moon, ruled out plans to deploy peacekeepers to Somalia saying it was not a viable option.