In antiquity, Berbera was part of a chain of commercial port cities along the Somali seaboard. During the early modern period, Berbera was the most important place of trade in the entire Horn of Africa. It later served as the capital of the British Somaliland protectorate from 1884 to 1941, when it was replaced by Hargeisa. In 1960, the British Somaliland protectorate gained independence as the State of Somaliland and united five days later with the Trust Territory of Somalia (the former Italian Somalia) to form the Somali Republic. Located strategically on the oil route, the city has a deep seaport, which serves as the region's main commercial harbour.
Duan Chengshi, a Chinese Tang dynasty scholar, described in his written work of AD 863 the slave trade, ivory trade, and ambergris trade of Bobali, which is thought to be Berbera. The great city was also later mentioned by the Islamic traveller Ibn Sa'id as well as Ibn Battuta in the thirteenth century.
Berbera was the most important port in the Horn of Africa between the 18th–19th centuries. For centuries, Berbera had extensive trade relations with several historic ports in the Arabian Peninsula. Additionally, the Somali and Ethiopian interiors were very dependent on Berbera for trade, where most of the goods for export arrived from. During the 1833 trading season, the port town swelled to over 70,000 people, and upwards of 6,000 camels laden with goods arrived from the interior within a single day. Berbera was the main marketplace in the entire Somali seaboard for various goods procured from the interior, such as livestock, coffee, frankincense, myrrh, acacia gum, saffron, feathers, ghee, hide (skin), gold and ivory.
Berbera commanded most of the trade traffic with the Somali and Ethiopian interiors. The two main caravan trade routes from Berbera extended to Harar and Shewa in the west, and to the Shebelle basin in the south. The westerly trade route was dominated by Habar Awal merchants, where they procured various goods such as coffee, saffron, ivory, and ostrich feathers. On the other hand, the southerly trade route was shared between Garhajis and Habar Awal merchants, where they obtained livestock, acacia gum, myrrh, grain and ghee. The inland caravan trade routes were also concurrently used as pilgrim routes by Somali Hajj pilgrims who resided in the deep interior.
In the post-independence period, Berbera was administered as the part of the North-Western province of the Somali Republic. After the collapse of the Somali central government and the ouster of the Dictatorship of General Siad Barre in 1991, the Somali National Movement (SNM), which was an insurgent movement fighting to remove the yoke of the Barre's dictatorship from the Northern region of the Somali Republic, declared the national independence of Somaliland Republic. A slow process of infrastructural reconstruction subsequently began in Berbera and other towns in the region.