Hester may well be presented as a Madonna-and-child figure. She is first presented to physically appear holding a child as she steps from jail.
Aslo, as Poster #2 suggests, there is a similarity between the shame Hester faces and that of Mary, the mother of Jesus. As noted by sources who have studied Hawthorne's novel, the Puritan society of which Hester is a part could well have had Hester put to death in face of the sin of adultery. Because her husband has been missing for almost two years, however, they decide to sentence her to wear a scarlet "A" on the bodice of her dress. Hester could leave, but chooses not to.
After Mary is betrothed to Joseph (which is the same, legally, as being married) and he finds Mary pregnant, Joseph—a good man—has two choices: however, both involve divorce.
And her husband Joseph, being a just man and unwilling to put her to shame, resolved to divorce her quietly. (Matthew 1:19 - ESV)
(Divorce is necessary as the betrothal is a binding, legal agreement.) However, if Joseph had divorced Mary publically, she could have been stoned to death by law. Divorcing her quietly, as Joseph chooses to do, would have spared Mary shame and possible death. (It is only God speaking to Joseph in a dream which causes him to put aside the divorce and take Mary as his wife.)
The Puritan culture chooses to handle the "punishment" of Hester in a gentler way because of "extenuating circumstances;" the same decision is presented to Joseph, and his choice to spare Mary is similar to what happens to Hester.