I believe that Hawthorne was suggesting that everyone is guilty of something and that it is human nature to use other people as scapegoats. Poor Hester Prynne is a scapegoat, as is her innocent daughter Pearl. Arthur Dimmesdale, the minister who fathered the child has to watch Hester being punished and ostracised for a sin in which he was equally guilty. This thesis or message alludes to the story in the New Testament in which a woman was brought to Jesus who had been caught in the commission of adultery. According to the law of Moses, the woman was to be stoned to death, and the men were ready to perform that execution immediately. They asked Jesus if he agreed, apparently in an effort to get him to contradict his own teachings or else go against the established law of Moses. According to John 8:7 and 8.9:
So when they continued asking him, he lifted up himself, and said unto them, He that is without sin among you, let him first cast a stone at her.
And they which heard it, being convicted by their own conscience, went out one by one, beginning at the eldest, even unto the last: and Jesus was left alone, and the woman standing in the midst.
Every one of the men who was ready to stone the woman to death had to acknowledge to himself that he was guilty of sins that were equally bad or worse. Hawthorne used the same idea in his short stories "The Minister's Black Veil" and "Young Goodman Brown." The minister's black veil is a reminder to everyone in his congregation, which comprises nearly everyone in the town, that they have their own sins and should be covering their own faces. In "Young Goodman Brown" it turns out that most of the sanctimonious people in town, including Brown and his wife, attend devil-worshipping orgies out in the forest at night. There are other Hawthorne stories with the same general bent, including "My Kinsman, Major Molineux."
Henry James said of Hawthorne that he seemed obsessed with "the old secret" that people are not as good as they pretend to be. Mark Twain had fun with this idea in his short story "The Man Who Corrupted Hadleyburg."