The roadside bomb went off outside a tea shop where soldiers were relaxing, a police official said, blaming the attack on Al-Qaeda-linked Shebab militants.
"Four soldiers were killed and eleven others including civilians were injured," police officer Mohamed Duale told AFP.
"Some of the wounded are in a serious condition and have been taken to hospital," he said.
"It looks like Al-Shebab but we are still investigating," he added.
An eyewitness, Bare Moalim, said several women were among those hurt.
"Some of the injured may not live because of the severe wounds," he added.