“We stand in solidarity with the New Zealand government and the Muslim community.” Farmajo tweeted.
“We must unite to defeat the evil of terror in all its forms,” he added.
Forty-nine people have been killed and at least 48 were injured after shootings which targeted two mosques.
At least four people from Somalia have been killed in the attacks. One of the targets, the Al Noor mosque, is co-run by Somalis.
Those missing have been listed as originating from countries including Jordan, India, Pakistan, Bangladesh, Afghanistan and Saudi Arabia.
New Zealand’s Prime Minister Jacinda Ardern branded the killings a “well planned” terrorist attack.
Police said three men and a woman were in custody in connection with the attacks.