Indeed, it is ironic that Hawthorne should propose the image of the Virgin Mother with her Child; and, yet, its irony is also directed at the Puritans as Hawthorne points to the spiritual beauty of Hester in spite of her sin of adultery. Here Hawthorne ironically criticizes the sanctimonious hypocrisy of the Puritans that allows the sinner no redeeming qualities, no forgiveness. There in plain garb, scorned as she stands upon the ignominous scaffold,is the profound emanation of Hester's inner beauty of soul and beautiful love for her child, her image of "Divine Maternity":
Here, there was the taint of deepest sin in the most sacred quality of human life, working such effect, that the world was only the darker for this woman's beauty, and the more lost for the infant that she had borne.
Hawthorne's veritable comparison of Hester to the Madonna proves itself later in the narrative as she consoles the sick and aids the aged, so much so that the scarlet A is interpreted as meaning "Able" and even "Angel."
It is also ironic considering the sacredness of the depiction of the Madonna and Child to the Catholic faith. Hester and her community were of the Puritan faith, and like other Protestant sects that came out of the Reformation, considered imagery and revering of Saints (like the Madonna) to be heretical and blasphemous.
You can find images of the Madonna in churches and museums throughout the world, but, even though Mary was the mother of Christ, Protestants don't pray to her or consider her to be a Saint as Catholics do. Protestants, including Puritans don't believe in Saints of any kind.
So, for Hester to be condemned by her community as blasphemous herself for her adulterous actions and then alluded to as a Madonna figure, seems an interesting sort of poetic justice that was probably not an accident on Hawthorne's part.
In The Scarlet Letter, Hawthorne introduces the female protagonist Hester Prynne in the second chapter, and we follow her journey from that point until the end of her life. We first see her as she walks out of prison and is escorted through town by the town beadle. She is gossiped about by the women and whispered about by everyone else as she makes her way, clutching a three-month-old baby to her bosom, to the scaffold. She has been sentenced to stand there, in full view of the entire town, for her sin of adultery--of which an embroidered scarlet letter on her bosom and her illigitimate child serve as emblems. The irony is in the description of Hester by the narrator as somehow resembling, despite her guilt and shame, the Madonna and child--which, of course, refers to Mary, mother of Jesus, and the baby Jesus, her son. Here is a fallen woman (at least she was considered so by this Puritan community) who has clearly committed the act of adultery being compared to a pure woman who was a virgin when she delivered her Son (the Son of God) into this world by Divine conception. This sharp contrast between what Hester appears to be and what she is, is what creates the irony in this description.