Security officials and witnesses say four Indian nuns were among the dead at the retirement home in the city of Aden.
Yemeni Civil War
Began in 2015 between two factions claiming to constitute the Yemeni government
The main fight is between forces loyal to President Abdrabbuh Mansour Hadi, and those allied to Zaidi Shia rebels known as Houthis, who forced Mr Hadi to flee the capital Sanaa in February 2015
Both President Hadi and the Houthis are opposed by al-Qaeda in the Arabian Peninsula - which has staged numerous deadly attacks
The gunmen moved from room to room, handcuffing the victims before shooting them in the head.
A nun, who was rescued by locals, said she hid inside a fridge in a store room after hearing a Yemeni guard shouting "run, run".
One witness, Khaled Haidar, said he counted 16 bodies, including that of his brother Radwan.
Khaled Haider said six Ethiopians, one Yemeni cook and Yemeni guards were among those killed.
He said his family was the first to arrive at the house and he spoke to the surviving nun, who was crying and shaking.
His family later handed her over to southern fighters in charge of security in the Sheikh Osman district of Aden.
There were around 80 residents living at the home which is run by Missionaries of Charity, an organisation established by Mother Teresa.
Missionaries of Charity nuns also came under attack in Yemen in 1998 when gunmen killed three in the Red Sea port city of Hodeida.
In summer 2015 the city of Aden descended into lawlessness after a Saudi-led coalition recaptured the city from Shiite Houthi rebels.
Yemen's war has killed at least 6,200 civilians and injured tens of thousands of Yemenis, while 2.4 million people have been displaced.