The symbolism of the forest (or Nature, in general) is juxtaposed with the symbolism of the town. In town, individuals are subject to the "self-appointed judges" who live there, bound by strict rules and vulnerable to mortifying or painful punishment; society seems awfully dark and negative in this novel. The forest, however, represents freedom and all of Nature, a force that does not seem to judge individuals according to the same set of corruptible rules; in fact, Nature seems to like it when people break "the rules." When Hester removes her scarlet letter and cap in the forest, the sun finally shines on her and she begins to resume some of her native beauty and tenderness. The forest is also where Hester and Dimmesdale are finally able to speak honestly and freely with one another for the first time in seven years.
However, the forest is also associated with temptation and darkness. The "Black Man" was another name for the Devil, and the Puritans believed that he might lurk behind every tree. Away from the rules of the town and society, individuals were out of bounds, liable to give in to temptation and commit sins. This would be confusing for Dimmesdale because, in the forest, he feels free, but perhaps dangerously so. He agrees to run away with Hester when they meet in the forest, but doing so would really only compound his sin by allowing him to continue to deny it.
In "The Scarlet Letter", the forest has a dual symbolic meaning. This is not unusual in Nathaniel Hawthorne's stories because he believed in the duality of meaning--in other words symbols can have more that one meaning. First, the forest is characterized as a dark place, home of the "black man of the forest" or the devil. Mistress Hibbins tries to get Hester to come to the forest and meet the black man after she almost loses custody of Pearl. However, the forest is also characterized as a place of freedom, where Hester is free to take off the scarlet letter and she and Dimmesdale meet secretly and plan their escape from Boston. By running away with Hester, this would compromise Dimmesdale's morals even more. He is already torn about not revealing his sin and to run away without public penance would seem to him to be even more damning. But in the forest, he feels free to agree to exactly that.