Three civilians also died and 15 other veterans were wounded in the attack on Friday.
The mortars were believed to have been fired towards Mogadishu's port but landed in the residential area by mistake, officials said.
Former army officers paralysed or missing limbs from the country's 1977 war with Ethiopia resided in the hospital, said Shiek Abdirisaq Oeylow, a government spokesman.
Somalia has suffered civil war for the past 18 years and African Union peacekeepers are currently in the country aiming to back the government of Sheikh Sharif Ahmed.
The government holds only a few areas of Mogadishu and al-Shabab, an opposition group, is attempting to overthrow them with the suspected help of foreign fighters.
The US has accused al-Shabab of having links with al-Qaeda, which al-Sahbab denies.