In the 11th century, this area was occupied by a Romanesque church, which was built there for foreign merchants coming to the near Týn Courtyard. Later it was replaced by an early Gothic Church of Our Lady in front of Týn in 1256. Construction of the present church began in the 14th century in the late Gothic style under the influence of Matthias of Arras and later Peter Parler. By the beginning of the 15th century, construction was almost complete; only the towers, the gable and roof were missing. The church was controlled by Hussites for some time, including John of Rokycan, future archbishop of Prague, who became the church's vicar in 1427.
The roof was completed in the 1450s, while the gable and northern tower were completed shortly thereafter during the reign of George of Podebrady. His sculpture was placed on the gable, below a huge golden chalice, the symbol of the Hussites. The southern tower was not completed until 1511, under Matěj Rejsek. In 1626, after the Battle of White Mountain, the sculptures of George of Podebrady and the chalice were removed and replaced by a sculpture of the Virgin Mary, with a giant halo made from by melting down the chalice. In 1679 the church was struck by lightning, and the subsequent fire heavily damaged the old vault, which was later replaced by a lower baroque vault.
Renovation works carried out in 1876-1895 were later reversed during extensive exterior renovation works in the years 1973-1995. Interior renovation is still in progress.