In Chapter 8, Hester comes very close to losing custody of Pearl. Governor Bellingham tells her that Pearl may be taken away from her for the good of the child's character. Hester explains that she would surely be the one best fit to teach Pearl morality because of the lessons learned from the scarlet letter Hester wears. Dimmesdale further explains that leaving Pearl with Hester is good for Hester's soul, that Pearl's very presence protects Hester from further sin. That is the point he makes which persuades Bellingham that Pearl should not be removed from her mother's care.
In one account of this incident, the narrator says, Mistress Hibbens then asks Hester to come to the forest (the place synonymous with sin and evil) to meet with witches. Hester replies that if Pearl had been taken from her, she might have gone. This conversation with Mistress Hibbens proves Dimmesdale's earlier point: Having Pearl by her side has protected Hester's soul.
There is great irony in this scene. By fathering Pearl, Dimmesdale led Hester into sin. By acting to keep Pearl with her mother, Dimmesdale saves Hester from sin.