I have always read this story as part of Hawthorne's continuing exploration of a theme he expressed directly in The Scarlet Letter.
And be the stern and sad truth
spoken, that the breach which guilt has once made into the human
soul is never, in this mortal state, repaired. It may be watched
and guarded, so that the enemy shall not force his way again
into the citadel, and might even in his subsequent assaults,
select some other avenue, in preference to that where he had
formerly succeeded. But there is still the ruined wall, and near
it the stealthy tread of the foe that would win over again his
Parson Hooper has committed some sin, the exact nature of which is never reveals, although there are hints that it had something to do with the young woman in the coffin, especially since the veil and the funeral are tied together. He elects to display knowledge of his guilt to the community, although he never tells them what he has done, just as their "secret sin" remains unknown to him. Ironically, he, as Dimmesdale, become a better minister through his personal suffering.
His new appearance, and that is all that has changed, just his appearance, frightening the congregation, perhaps because he is now a mirror to them of things they would rather not face. Hooper could easily have taken off the veil, much as Hester could have taken off the Scarlet Letter when she return to the colonies ... but the taking off would not heal the breach, so they both elect to acknowledge their failing, one specified, the other not, until death.
It's difficult for us, inhabitants of a world that almost denies sin, to understand their position, but for older generations sin was as real as psychosis is to us in the era of Freud. When you sinned, you created a breach that was never really healed in this life. This story, like many others of Hawthorne, explore this breach and its implications.
Hawthorne's story about a minister who wears a black veil to hide his face from the world contains levels of meaning that is reflective of both his writing and the American literary movement at the time. The story's macabre tone and repressive early-colonial New England Puritan setting are familiar elements in Hawthorne's fiction, and they serve to underscore the unsettling behavior of the main character and the work's concern with the nature of secret sin and humans' fallen nature. We see this in his work, considerably present in The Scarlet Letter, where society, hypocrisy, and lapsed faith seem to converge in the character of Hester. Hawthorne's intended meaning with the tale has been the subject of considerable debate, with critics seeing it variously as a deprecation of Puritan fanaticism, a study of a misunderstood outsider ostracized by a community's intolerance, and an exploration of the clergyman's guilt after his crime against a young woman. Other readers argue that the tale is purposefully ambiguous because the psychological and religious complexity it seeks to express could not be captured in a straightforward moral tale. This is reflective of American literature at the time which sought to explore moral complexities and ambiguity in its art, as evidenced in other writers of the time, such as Melville.