The first recorded document mentioning Debar is the map of Ptolemy, dating around the middle of the 2nd century, in which it is called Deborus. The Byzantine emperor Basil II knew of its existence, and Felix Petancic referred to it as Dibri in 1502.
The city was subsequently conquered by the First Bulgarian Empire, but lost to the Byzantines under Tsar Samuil by the early 11th century, as Bulgaria was subjugated.
Bohemond and his Norman army took the city in 1107. In the 13th and 14th century, the city changed hands between the Despotate of Epirus, the Second Bulgarian Empire, the Byzantine Empire and Serbia.
The city was under the rule of the short-lived Principality of Prilep of Prince Marko (r. 1371 – 1395), a successor state of the Serbian Empire (1346–1371) where the father of Prince Marko, Župan Vukašin Mrnjavčević (co-ruler of King Stefan Uroš V) held the region. The principality and region came under Ottoman Turkish rule in 1395.
It was conquered by the Ottomans in 1395 and subsequently became the seat of the Sanjak of Dibra. In 1440 Skanderbeg was appointed as its sanjakbey.
During the Ottoman-Albanian wars between 1443-1479 the Debar region was the borderline between the Ottomans and the League of Lezhë led by Skanderbeg and became an area of continuous conflict. There were two major battles near Debar April 29, 1444 and September 27, 1446, both ending with the defeat of the Ottoman armies.
In the early 19th century, when Debar rebelled against the Turkish Sultan, the French traveller, publicist, and scientist Ami Bue observed that Debar had 64 shops and 4,200 residents. It was first a sanjak centre in Scutari Province before 1877, and afterwards in Monastır between 1877-1912 as Debre or Debre-i Bala ("Upper Debre" in Ottoman Turkish, as contrasted with Debre-i Zir, which was Peshkopi's Turkish name). Debar was significantly involved in the national Albanian movement and on November 1, 1878 the Albanian leaders of the city participated in founding the League of Prizren. By the end of the century, the town had 15,500 residents, but after World War I, this number started to decline.
During the First Balkan War of 1912-1913, the city was annexed by the Kingdom of Serbia. In September 1913 there was an uprising by the Macedonians of Debar with the aim of separating from the Kingdom of Yugoslavia. In September 1913 local Albanian and Internal Macedonian Revolutionary Organization leaders rebelled against the Kingdom of Serbia.
Debar was annexed, along with most of Western Macedonia, into the Kingdom of Italy on June 29, 1939. Greater Albania was officially a protectorate of Italy and therefore public administration duties were passed to Albanian authorities. Albanian-language schools, radio stations and newspapers were established in Debar. When Italy capitulated in September 1943, Debar passed into German hands. After a two month struggle for the city between Albanian National Liberation Front and German forces including the SS Skanderbeg division, the Communist forces led by Haxhi Lleshi finally secured Debar on August 30, 1944. After the cessation of hostilities and the establishment of Communism in both states, Debar passed back into Yugoslav hands.