Fighting was still going on inside the compound, which includes regional president Sharif Hassan's palace, police captain Ali Ahmed said. Hassan was unhurt and had been escorted to Baidoa's airport by African Union (AU) soldiers, he said.
It was not clear whether Hassan had been in the palace when it was attacked.
Al Shabaab often targets official buildings and politicians in the capital Mogadishu in its efforts to topple the Western-backed government and impose its strict interpretation of Islam.
"First, a car bomb exploded at the southwest palace gate and then armed fighters went in," Ahmed, told Reuters from Baidoa, which is about 250 km (150 miles) northwest of the capital.
"So far, six policemen died," he said.
A second police officer said at least eight people were injured and three of the militants were killed.
Al Shabaab confirmed that three of its fighters were killed.
The group also claimed to have killed 12 Ethiopian soldiers from the AU force (AMISOM) that has been fighting alongside Somali troops but that could not be confirmed. Al Shabaab often says it has killed more than the number given by officials.
AMISOM said in the statement that the attack was a desperate attempt by al Shabaab to "seek relevance".
Ahmed said four police officers died in the car bomb explosion and two were killed in shooting inside the palace.