What your question seems to be asking is what two things motivated Hester Prynne to speak her mind and express herself as an individual despite of being considered a pariah by the elders and the other settlers.
If this is your question, then those two motivators are first, Pearl, and, second, the scorn that she secretly feels against the hypocritical society that condemned her.
Going back to chapter 5, "Hester at her Needle", we find that, even though she has been freed from prison and has been told to leave the settlement if she wishes, Hester still remains there. She does not dare to pray for those who still punish her daily for being the carrier of the scarlet letter, for fear that she (who considers herself as quite unlucky and fallen from Grace) might end up cursing them. Nevertheless, Hester expresses herself through her needlework. This is far from a mundane detail; Hester's talent actually helps to bring the town together in a subtle way. She works for both rich and poor alike, and she actually colors the settlement with her magnificent works. In not so many words, she is ironically responsible for beautifying and adding style and class to an otherwise shoddy and sheepish community. Yet, she knows deep insider who she is working for: she knows the hypocrites of the settlement, and she knows that, if she were to put them all at the scaffold, they all would have something to answer for. Yet, unlike them, Hester serves them with all that she can give: beauty, refinement, and talent. This is a far cry from what the settlers could ever give her. This is indicative of Hester's higher ranking in the moral system despite of her sin.
The second motivator that makes Hester express herself is Pearl. In chapter 7, "The Governor's Hall", Hester's expressions know no limits. When she hears that the sanctimonious elders of the settlement have dared to think about removing Pearl from her she gives them a piece of her mind. Hester, without any fears, even summons Dimmesdale to speak on her behalf. Her strength of character far outweighs those of the men, even Governor Bellingham, himself. Moreover, Hester openly expresses that, if anything, they basically did her a favor by placing that scarlet letter on her bosom; for it has helped her grow, mature, become stronger, and be a good mother to her daughter.
In all, Hester's character is meant to serve as an anchoring force among the sheep-like, ignorant, sanctimonious and hypocritical settlers that surround her. Her punishment in no way dims her character, and there is no way that the settlers could ever beat her at any rate.