At least two police officers were killed but none of the Turkish delegates were wounded in the attack, which was claimed by Islamist al Shabaab rebels, officials said.
Erdogan, who was in the Ethiopian capital Addis Ababa on the first leg of an African tour when the bomb went off, appeared unfazed and said that whoever carried out the attack was not acting in the name of Islam.
"There has been a terrorist attack today in Somalia. What is this attack carried out for? If they are doing it in the name of Islam, there is no such thing in Islam," he said at Addis Ababa University, where he was receiving an honorary degree.
Turkish Prime Minister Ahmet Davutoglu, speaking at the World Economic Forum in Davos, said an investigation was under way to see if the Turkish delegation was deliberately targeted.
Al Shabaab, which has carried out attacks across east Africa including a 2013 raid on a Nairobi shopping mall that killed 67, claimed responsibility for the assault but did not mention the delegation or Erdogan.
"We attacked (the) hotel and killed several of the Somali police officers who were meeting there," al Shabaab's military operations spokesman, Sheikh Abdiasis Abu Musab, told Reuters.
A Reuters witness saw two police officers lying dead in front of the destroyed gate, and what appeared to be the mangled body of the suicide bomber.
"The Turkish delegates are safe inside the hotel," police captain Farah Nur told Reuters. "The hotel was busy."
Erdogan became the first non-African leader to visit Somalia in nearly 20 years when he travelled there in 2011, as Turkey's prime minister.
Turkey is a key ally of the Somali government in efforts to rebuild after more than two decades of conflict and famine. It was a major contributor to the humanitarian aid effort at the height of the 2011 famine and Ankara continues to build hospitals and dispatch aid across Somalia.
There have been attacks on Turkish interests in Somalia before. In July 2013, a car loaded with explosives rammed into an office housing Turkish embassy staff in Mogadishu, killing three people. That attack was also claimed by al Shabaab.