In his own guilt over his relationship to an uncle who was a judge in the Salem Witch Trials, Hawthorne realized the destruction to the human heart that Puritanism has caused. For, in denying the human weakness of sin, Puritanism created a prison within which the spirit and heart of people must live. In "The Scarlet Letter," the first chapter opens with the Puritans, in their grey hats and garb standing outside the incongruous prison door. (If the Puritans came to America for religious freedom, why do they need a prison?) Is this prison meant to lock in/isolate sin and deny the fallible humanity of men and women that cannot truly be denied?
It is because of this Puritan society that Hester Prynne and Arthur Dimmesdale suffer. By her admission and obvious condition of sin, Hester is isolated from the townspeople. However, she is liberated later through her charitable works which atone for her sin.
This redemption underscores the point that Hawthorne has made about the evil restrictiveness of the Puritan code. For, Dimmesdale is much more isolated than Hester in his secret sin, imprisoned as a Puritan minister who cannot confess without ruining his life. Isolated from all, Dimmesdale's very spirit dies from this deprivation. Isolation is death--death to the human heart and spirit; thus, it is the greatest of evils.
Hester Prynne is forced to be isolated in The Scarlet Letter. This isolation is obviously harsh for a sin she committed with someone else. On the other hand, she is isolated within society. She chooses not to run off into the woods/wilderness. She in fact grows from her isolationism - she raises Pearl and she goes good works for the community. Dimmesdale on the other hand is not isolated and committed the same sin. Through his own guilt and Chillingworth's influence, he comes forward to the community, which had embraced him.