UN officials were not immediately available for comment.
Al-Shabab is fighting to overthrow Somalia's government, and controls large areas of the capital and southern Somalia.
The group is fighting government troops and African Union peacekeepers in the hope of imposing its own strict interpretation of sharia, or Islamic law, throughout Somalia.
The US state department says that the group has links to al-Qaeda, but al-Shabab has denied that.
Speaking about the incident in Baidoa, an unnamed UN officer said that "dozens of well-armed al-Shabab militia" had surrounded the UN compound there.
He continued: "They have taken away three UN cars from the compound, but have not harmed several UN foreign staff."
The town of Baidoa used to house Somalia's interim parliament before it was seized by al-Shabab fighters.