The composing of the cantata was Dvořák's reaction to the death of his daughter, Josefa. The sketch was written between 19 February and 7 May 1876, and was dedicated to František Hušpauer "as a souvenir to the friend of his young days." However, Dvořák was forced to postpone the orchestration of the work due to his other obligations. He returned to the final stylisation of the composition in 1877, when his two surviving children died within a short time of each other. The definitive version of the score was written between the beginning of October and 13 November 1877 in Prague.
Stabat Mater is Dvořák's first work on a religious theme. It is divided into ten individual parts; only the first and the last part are thematically connected.
The first performance took place on 23 December 1880 at the concert of the Jednota umělců hudebních (Association of Musical Artists) in Prague. The performers included the operatic ensemble of the České prozatímní divadlo (Czech Provisional Theatre), under the conductor Adolf Čech, with the soloists Eleanora Ehrenbergů, Betty Fibich, Antonín Vávra and Karel Čech. The composer Leoš Janáček conducted the work a year and half later, on 2 April 1882, in Brno. Performances abroad (Budapest, London) soon ensued.
The cantata was published in score, with parts and piano vocal score (arranged by Dr. Josef Zubatý) by German publishing house N. Simrock in 1881. On this occasion Dvořák also changed the opus number.