The boat sank off the coast of Cabo Delgado province, about 200km from the border with Tanzania.
Mozambique is becoming an increasingly popular transit point for people fleeing the Horn of Africa trying to reach South Africa.
Police in Mozambique have detained 618 illegal immigrants in the past week.
Somalia remains one of the most insecure places in the world, with widespread fighting between government forces and armed groups.
Hundreds of thousands of Somalis have fled to neighbouring nations and tens of thousands of others have fled by boat to Yemen and other countries.
In May, fighting intensified in Mogadishu and displaced more than 270,000 people, according to the United Nations.