It was first mentioned in the 10th century by Constantine Porphyrogenitus, under the name of Tribunia. At the time Trebinje was on the caravan route that led from Kotor and Dubrovnik to Bosnia, Serbia and Montenegro. The town began to assume the urban shape in the Middle Ages. It was first within the former Byzantine archontius, and then, until the 14th century, the centre of the state of Travunia, a part of the Nemanjić dynasty state.
At the beginning of the Common Era and during the Middle Ages, Trebinje area was developing under the strong influence of the Byzantine Empire until the 15th century when, after a long period of independence, the area fell under the centuries-long Ottoman administration and then, until 1918, under the rule of Austro-Hungarian Empire. In the Middle Ages, Trebinje was under the rule of the Nemanjić dynasty for almost 200 years, and then under the rule of Tvrtko Kotromanić. From 1377 until the fall under the Ottoman rule in 1466, Trebinje was within the Bosnian Banate, ruled by Kosača noble family. Trebinje was under the Ottomans from 1466 to 1878. The Old Town of Trebinje was founded in the early 17th century on the River Trebisnjica and was called Ban Vir at the time.
Today, it is the Old Town-Kastel and originates from the former trade and craft centre.