The threats were issued shortly after an Italian nun and her bodyguard were gunned down in the capital, Mogadishu on September 17.
The president of Somalia's weak interim administration, Abdullahi Yusuf Ahmed, narrowly escaped a suicide car bombing a day later.
Although no-one has claimed responsibility for the attacks, suspicion has fallen on the Islamic militias currently controlling wide swathes of the south and centre of the country, which deny involvement.
"Given the insecure environment and the subsequent direct written threats against UN staff, a decision was taken to temporarily relocate all UN international staff members from southern and central Somalia until further notice," the organisation said in a statement.
The UN said it had also pulled its global staff out of the autonomous state of Puntland, while all UN missions in Mogadishu had been suspended until further notice.
No details were given of the nature of the threats, nor the numbers of staff or when they were withdrawn.
"The rapid expansion of the influence of the Islamic courts... has posed a serious challenge to the status quo"
UN statement on Somalia
The organisation said it is assessing the security situation in the country to see when its international staff can return.
Operations using Somali staff, meanwhile, are continuing, it said.
The UN also warned that the growing power of the Islamic militias, who have seized control of large swathes of the country from US-backed secular warlords in recent months, was posing a risk to the country's stability.
"The rapid expansion of the influence of the Islamic courts ... has posed a serious challenge to the status quo, the consequences of which could have serious access and security implications if responded to militarily," the UN report said.
It added that it was making contingency plans with other relief agencies to carry on humanitarian work in Somalia "given the possibility of wider conflict, which could pull in neighbouring countries".
The Islamic militia group has recently declared a holy war on Ethiopia, after Ethiopian forces reportedly helped Somali soldiers to seize control of a town in southern central Somalia.
Meanwhile, a group of clerics in the breakaway republic of Somaliland urged its government on Thursday to apply Islamic sharia law and to stop promoting itself as a secular state, Somaliland's Awdalnews agency reported.