The townsquare in Hawthorne's The Scarlet Letter is a place for gatherings, and we also find it is a place of judgment, accusation and confession. In striking contrast, the forest beyond the town is a place of secrets—the Puritans also believed it was a place ruled by the devil. (See evidence of this in Hawthorne's Young Goodman Brown and Arthur Millers The Crucible, where ungodly events transpire in the forest.)
The distinction between these two places is based upon practice and perception—for it is only perception that deems the woods a dangerous place, not for any events witnessed there! There were none. This town (because of its beliefs) made no distinction between what they believed and what was true. These were...
...a people amongst whom religion and law were almost identical, and in whose character both were so thoroughly interfused, that the mildest and the severest acts of public discipline were alike made venerable and awful.
For the Puritans, the town square is a place of exposure—the truth is told here, and the scaffold erected here carries out justice. The sense of the woods as a place of wrongdoing (on any level) is seen when Hester and Pearl meet Dimmesdale in the woods one day. Here the adults seem ready to leave behind the strictures of Puritan society that have controlled them now for seven years—since their secret affair, Pearl's conception, and Hester's lonely judgment by her peers.
Here Hester and Dimmesdale speak their hearts—bridging a gap borne of so many years of silence and separation. Hester at one point throws her arms around the clergyman, such freedom the forest offers. Here, without those to judge her for the letter on her chest, she feels some relief. And it is here that Hester proposes they leave the settlement and start life over again. And as a gesture of new life, she removes the scarlet letter and the cap she wears that holds back her flowing locks.
Ironically, it is Pearl, like an angel of judgment, who by her sensorous behavior, forces her mother to put the letter back on and her cap. This signals their transition back to the reality.
Finally, at the end, when Dimmesdale is dying, he meets Hester and Pearl in the town square; he mounts the scaffold and calls Hester to him as he prepares to confess—and to die. There on the scaffold where Hester once faced her accusers, here too Dimmesdale confesses his sin: his relationship with Hester.
Hester Prynne...in the name of Him, so terrible and so merciful, who gives me grace, at this last moment, to do what—for my own heavy sin and misterable agony—I withheld myself from doing seven years ago, come hither now, and twine thy strength about me...but let it be guided by the will which God hath granted me!
As the horrified townspeople listen, and the vengeful Chillingsworth tries to stop it (for his own "dark purposes"), Dimmesdale admits to his relationship with Hester. He was her lover; he is the father of little Pearl. As he collapses to the scaffold, with Hester trying to hold him up, he asks Pearl for a kiss now—that she would not give in the forest. Once again, the forest is a place of secrets, but here in the midst of his confession, when all comes to light, when his sin is exposed and the truth is known, Pearl does kiss Dimmesdale.
It would seem, too, that the forest is place of dreams that cannot stand up to the realities of the real world. And the harsh world and the truth are found in the town square.