Germany was consecrated to Mary in Fulda in the Marian Year 1950 by Cardinal Frings.
To consecrate means to dedicate to a sacred purpose. The term is often used by the Church for places (churches), persons (consecrated religious or lay persons) and liturgical objects, or, something which is central to the Christian faith, for the consecration of the Eucharist during each Mass (i.e the transubstantiation of the bread and wine). Out of devotion, a person can also consecrate herself (votive consecration) to Christ through Mary.
This personal consecration was extended to cities in the Middle Ages. For example King Louis XIII consecrated France to Mary in 1638, a move which has since been emulated by bishops and popes for specific countries and places, and even for the whole world.
The Immaculate Heart of Mary is a specific Catholic devotion focused on one aspect of the holiness of the Mother of God: her total purity - confirmed by the recent dogma of the Immaculate Conception in 1854. This devotion arose in the 19th century, but is a development of medieval theological works from Saint Anselm of Canterbury, Saint Bernard of Clairvaux, and others. It spread throughout France after the 1830 apparition at the Rue du Bac in Paris, in which the Virgin Mary reaffirmed the immaculate nature of her soul to Saint Catherine Labouré.
But it was especially with the Marian apparitions of Fatima (Portugal) in 1917 that devotion to the Immaculate Heart of Mary acquired the importance it has today. During an apparition, the Virgin Mary declared that in order to save souls from hell, God wished to "establish in the world the devotion to her Immaculate Heart".
Adapted and translated from: https://www.cath.ch