The Immaculate Heart of Mary has several scriptural basis - in Saint Luke's Gospel, Mary kept all things in her heart that she might ponder over them and the prophecy Simeon told her that her heart would be pierced with a sword.
Records show that the feast of the Heart of Mary was celebrated as early as 1643 by Saint John Eudes on February 8th of each year. Pope Pius VI granted the Bishop of Palermo the feast of the Most Pure Heart of Mary in his diocese. Two major movements would push the Vatican to approve the feast widely - the Miraculous Medal in 1830 and the establishment at Notre-Dame-des-Victories of the Archconfraternity of the Immaculate Heart of Mary, Refuge of Sinners. The Congregation of Rites formally approved the Office and Mass of the Most Pure Heart of Mary on July 21st, 1885 but did not yet impose it for the entire church.
In 1933, Pope Pius XII instituted the Feast of the Immaculate heart of Mary for a celebration of August 22nd. This August date meant it would fall into the traditional octave day of the Assumption. It was moved in 1969 by Pope Paul VI and placed on the Saturday immediately following the Solemnity of the Sacred Heart of Jesus. Because it is a movable feast, the celebration is omitted if it falls on the date of another high ranking feast (for example, the Nativity of Saint John the Baptist or the Visitation of the Blessed Virgin Mary).
Much like the consecration of the human race to the Sacred Heart of Jesus, several Popes have consecrated the world to the Immaculate Heart of Mary -
Pope Pius XII on October 31, 1942
Pope Paul VI on November 21st, 1964
Pope John Paul II on may 13th, 1982
Pope Francis on October 13th, 2013