The execution took place in southern town of Jilib on Sunday.
An-Shabab judge in Jilib said the men, identified as Gabow ibrahim, 36, and Mohamed Abdi, 29, were found guilty of killing Adan Hassan near Jilib.
Accused persons brought before Al-Shabab courts do not get fair hearing and legal representation. The group has executed dozens of people in the last few years, most victims accused of espionage and adultery.
Last week, it carried out an attack on the Ministry of Interior compound, killing five people.