The slopes of Blagaj hill were inhabited as long ago as prehistoric and Roman times. The first indirect written sources on Blagaj date from the 10th century. The earliest reference to the town by the name of Blagaj was in 1423, when the Blagaj fort (Stjepangrad) was one of Bosnia's major strongholds.
The most important finds on the outskirts of the fort dating from that period are stećak - tombstones and the stone judge's seat found in the nearby village of Kosor. From 1466 on, when Blagaj became part of the Ottoman Empire, the Ottomans transfermed the mediaeval outskirts of the fort into an urban centre. The folk saying šeher Blagaj, a kasaba Mostar (Blagaj is a city, and Mostar only a town) survived as evidence of the former importance of the town on the source of the river Buna.