Hawthorne pits the natural world against the civilized world in The Scarlet Letter. The natural world symbolizes the freedom that has been driven out of Puritan society. But this is not simply a good/evil dichotomy. The chaos and anarchy of nature can also represent a threat. Moral goodness lies somewhere between Puritan society and unbridled nature. Nature imagery in the novel reflects this ambiguity.
Early on, Hester is likened in a positive way to nature, depicted as a healthy growing plant that the repression of a prison, a symbol of civilization, can't obliterate. She is implicitly like the wild roses blooming outside the prison door:
A wild rose-bush, covered, in this month of June, with its delicate gems, which might be imagined to offer their fragrance and fragile beauty.
Hester, like the rose, has a fragrance and fragile beauty to offer the world. This symbolizes the part of her soul that can't be crushed by social forces. The rosebush is also explicitly tied to another good woman who rebelled against oppression, Anne Hutchinson.
Later, however, Hester's association with nature becomes problematic:
She had wandered, without rule or guidance, into a moral wilderness. ... Her intellect and heart had their home, as it were, in desert places, where she roamed as freely as the wild Indian in his woods. ... The scarlet letter was her passport into regions where other women dared not tread. Shame, Despair, Solitude! These had been her teachers—stern and wild ones—and they had made her strong, but taught her much amiss.
Here we see that nature has both strengthened Hester but also threatens to lead her too far outside the moral imperatives of civilization. Indians are associated with both nature and the devil in Hawthorne's work, so Hester wandering as freely as an Indian is a signal of danger.
Pearl is even more strongly associated with nature than Hester. She is depicted as a wild creature, reflecting her out-of-wedlock birth. Flowers and plants suit her better than the jewels associated with civilization. Hester states,
Those simple flowers adorn her! Had she gathered pearls, and diamonds and rubies, they could not have become her better.
Hester grows through suffering but mostly through occupying a space on the fringes of society, on the border between civilization and nature. By drawing from and balancing both spheres of life, she becomes a person of great strength and moral worth.