The Puritans were a rather idiosyncratic bunch, and one would be hard-pressed to find another group that is more strident in their moral beliefs and, perhaps ironically (or perhaps not), more judgmental of those who fail to uphold them. They left England because they were so dissatisfied with the Church of England and didn't feel that it had gone far enough in purifying the traditions and values of the Catholic Church. The Puritans then founded the Massachusetts Bay Colony with the avowed purpose of creating a perfect society where the civil and ecclesiastical life of the community were one and the same. They felt that they would be as a city on a hill, according to their first governor, John Winthrop—a beacon of light which the rest of the world could look to in order to know how to live truly good and righteous lives.
From 1630 through the Salem Witch Trials in 1692, the community thrived; after the witch hunts, however, Puritanism began to disappear. Therefore, this story really does need to occur in this time and in this place in order for Hawthorne to capitalize on the strict morality and, in many cases, the hypocrisy of the Puritans. Hester's "crime" would not necessarily be a legal crime in other times and places, and her punishment would certainly be different depending on when and where the story was set. Hawthorne is also extremely disillusioned with the Puritans and often writes about their society in unflattering and judgmental ways. Certainly, a version of this story could exist in many different times and places, but the Puritans in America represent a very unique setting that sets this story apart in many ways.