During the Middle Ages the current territory of the town was divided between Veprinac (nowadays a locality of Opatija) and Kastav (the fishermen's village of Veprinac). The small hamlet of Opatija itself developed around a Benedictine abbey dedicated to St. Jacob. Since 1420 the western Istria was gradually conquered by the Republic of Venice and the remaining territory up to Opatija fell to the House of Habsburg and later was incorporated into the Austrian Littoral.
The modern history of the town began in 1844, when Iginio Scarpa, a wealthy merchant from Rijeka, built Villa Angiolina manor, where notable guests often come. The Austrian Southern Railway company opened the branch line from Pivka to Rijeka via nearby Matulji in 1873 and supporting the development of tourism in Opatija and neighbouring Lovran. Some years later, the railway company purchased the Villa Angiolina. At the time, Friedrich Julius Schüler, the Managing Director of the Southern Railways, started the construction of the Hotel Quarnero (Kvarner Hotel) and the Hotel Kronprinzessin Stephanie (today Hotel Imperial), and was responsible also for the unique lungomare and parks.
In 1887 was established the "Union Yacht Club Quarnero" in Opatija - the first sailing club on the Adriatic coast. Two years later the Cisleithanian government officially declared Abbazia (Opatija) the first climatic seaside resort on the Austrian Riviera.
During World War I, in 1920 Opatija was assigned to Italy. In 1922, Italy started a program of forced italianization of the population, and most of the public positions were assigned to Italian-speaking citizens.
In 1947 Opatija was given to Yugoslavia. Most of the Italian-speaking population, whose percentage had significantly increased, emigrated to Italy. The first casino in Eastern Europe was opened in Opatija - the "Casino Rosalia". In 1981 the Hotel "Admiral" and marina were inaugurated. In 1991 with the breakup of Yugoslavia, the town became part of Croatia.