According to archeological surveys, the area of the present castle has been settled continuously since 1200 BC, when the first settlements and later fortifications were built.
The castle was first mentioned in 1144 as a seat of the Carinthian dukes of the House of Spanheim.
In the 15th century, the castle was enlarged with a complete wall and towers at the entrance, where a drawbridge was placed. A chapel was also built at that time. In the 16th and 17th centuries, other objects were gradually built.
Because it was not a home of a ruler or another important noble person and because a fortification in the area was no longer required, the castle started to lose its importance. The maintenance costs were too high so the castle began to crumble.
In the 19th century, the castle was redesigned partially as a prison and partially as a military stronghold, making it less popular among the citizens.
In 1905, the castle was bought by the Ljubljana Municipality, who settled it. The residents stayed there until the mid-1960s, when preparations for renovation of the castle began.
At the end of the 1960s, the long and extensive renovation works started. The whole renovation took more than 35 years. In the 1990s, the use of the castle as a place for weddings and cultural events began.
The Ljubljana Castle funicular, a funicular railway to the top of Castle Hill, was built in 2006 and brought to service in 2007.
The hill also features a monument dedicated to the Slovenian peasant revolts (of 1515 and 1573).
The remains of the fortifications on Castle Hill were redesigned into a promenade, called Šance. The author of the design was the Slovenian architect Jože Plečnik.