In prehistoric times, the Celtic tribe Latobics lived in Trebnje territory and in Roman times there was a famous outpost along the Emon - Siscia road. It was raised by the Roman Emperor Vespasian who named it Minicipium Praetorium Latobicorum. Remains of the Roman period are still visible today: the soapstone at the Koščak House, the stone relief with three busts in the parish church and a stone lion at the top of the staircase at Trebanj Castle. With the departure of the Roman legions and the partial withdrawal of the Romanized inhabitants, the settlement became much smaller. Slavs and others began to penetrate this relatively empty area. The new settlers in the Trebnje area engaged in timbering, and one of the explanations for the name of Trebnje is allegedly derived from the logging of the forest.
In the Middle Ages, the town declined, and with the introduction of the regular postal service between Ljubljana and Karlovac, Trebnje became an important intermediate station. During this period, specifically around 1000, Trebanj Castle was built on the south side of the city and was first mentioned in written sources in 1386. It was owned by the Ortenburgs, Counts of Celje and the Habsburgs.
The town was first mentioned in 1163 as the seat of the parish and in 1351 as a market town. Especially after the completion of the Ljubljana - Zagreb motorway, Trebnje experienced a faster development and became a major economic center of the central part of the Temeniška Valley and at the same time the seat of a municipality with a well-developed industry.
The 15th meridian runs through Trebnje, which is marked at the eastern entrance to the city by a large clock board with accurate Central European time and a stone sign on Vrhtrebnje. The late Gothic triladian parish church of the Assumption of Mary, dating from 1443, which was converted in 1645, is a typical symbol of the place. In front of the church there is a monument to fallen soldiers in World War I, and at the entrance stands a statue of Baraga, made by France Gorset in 1978.
Trebnje became known to the wider world through the International Meetings of Naive Artists, which have been organizing numerous exhibitions and artists' annual meetings since 1968. More than 1000 works of art created at these camps are offered by the Shelter Gallery of Fine Self-Growers, which is the only collection of naive art in Slovenia and one of the most important in the world.