The al-Qaeda-linked group claimed to have held the soldier since September 2015.
The troubled country is holding crucial parliamentary and presidential elections.
Mohamud is running for re-election this fall.
The country's president will be elected by MPs, not by a popular vote.
ISIS claimed responsibility for an attack in Somalia for the first time in April.
The Al-Qaeda aligned group is expected to increase attacks ahead Somali elections in 2016
A Somali government official said that 15 militants were killed in the mysterious attack.
Kenya refuses to give a death toll for the Al-Shabab attack on an African Union base in Somalia.
The Somali militants claimed to have killed more than 100 soldiers in the attack on El Adde.