While devotion to the Immaculate Heart of Mary was revealed through various private revelations, such those of Our Lady to the children of Fatima, it can be supported by the Bible.
Full of Grace
First of all, Mary is called “full of grace,” a term that reflects her “immaculate” (from the Latin for “without stain”) state.
And he came to her and said, “Hail, fullofgrace, the Lord is with you!”
Luke 1:28
The Catechism of the Catholic Church explains this connection.
Through the centuries the Church has become ever more aware that Mary, “full of grace” through God, was redeemed from the moment of her conception. That is what the dogma of the Immaculate Conception confesses, as Pope Pius IX proclaimed in 1854.
CCC 491
A Sword will Pierce
The Gospel of Luke also talks about Mary’s heart, in the context of Simeon’s prophecy at the Temple.
“Behold, this child is set for the fall and rising of many in Israel,
Luke 2:35
and for a sign that is spoken against
(and a sword will pierce through your own soul also),
that thoughts out of many hearts may be revealed.”
This particular passage is often visually represented in art with a sword piercing Mary’s heart.
Putting these two concepts together, devotion to the Immaculate Heart of Mary finds support in the Bible.