Somalia is boarded to the weast and north by the Indian Ocean, by Ethiopia to the west, Djibouti to the northwest, the Gulf of Aden to the north, the Guardafui Channel and Somali Sea to the east, and Kenya to the southwest. It is separated from Socotra by the Guardafui Channel in the northeast and from the Seychelles by the Somali Sea. It is located in the Horn of Africa.
In antiquity, Somalia was an important commercial centre. It is among the most probable locations of the fabled ancient Land of Punt. During the Middle Ages, several powerful Somali empires dominated the regional trade, including the Ajuran Empire, the Adal Sultanate, the Warsangali Sultanate, and the Sultanate of the Geledi.
The Laas Geel complex on the outskirts of Hargeisa in northwestern Somalia dates back around 5,000 years, and has rock art depicting both wild animals and decorated cows. Other cave paintings are found in the northern Dhambalin region, which feature one of the earliest known depictions of a hunter on horseback. The rock art is in the distinctive Ethiopian-Arabian style, dated to 1,000 to 3,000 BCE. Additionally, between the towns of Las Khorey and El Ayo in northern Somalia lies Karinhegane, the site of numerous cave paintings of real and mythical animals. Each painting has an inscription below it, which collectively have been estimated to be around 2,500 years old.
The camel is believed to have been domesticated in the Horn region sometime between the 2nd and 3rd millennium BCE. From there, it spread to Egypt and the Maghreb. During the classical period, the northern Barbara city-states of Mosylon, Opone, Mundus, Isis, Malao, Avalites, Essina, Nikon and Sarapion developed a lucrative trade network, connecting with merchants from Ptolemaic Egypt, Ancient Greece, Phoenicia, Parthian Persia, Saba, the Nabataean Kingdom, and the Roman Empire. They used the ancient Somali maritime vessel known as the beden to transport their cargo.
Trading relations were established with Malacca in the 15th century, with cloth, ambergris and porcelain being the main commodities of the trade. Giraffes, zebras and incense were exported to the Ming Empire of China, which established Somali merchants as leaders in the commerce between East Asia and the Horn. Hindu merchants from Surat and Southeast African merchants from Pate, seeking to bypass both the Portuguese blockade and Omani interference, used the Somali ports of Merca and Barawa (which were out of the two powers' jurisdiction) to conduct their trade in safety and without interference.