The president’s office offered no other details on the incident.
“Earlier today, I was appalled and saddened to learn we lost nine young patriots to a cowardly terrorist attack in Somalia,” Kenyatta said in a statement.
A military source with knowledge of the incident said the soldiers were killed by an improvised explosive device in Dobley on Sunday.
Al Shabaab is fighting to topple Somalia’s central government and establish its own rule based on its strict interpretation of Islamic law.
The group also conducts frequent assaults in Kenya, mostly bordering Somalia, to put pressure on the Kenyan government to withdraw its peacekeeping troops from Somalia.
Kenya forms part of the African Union force AMISOM, which is defending Somalia’s government against al Shabaab.