Hardy depicts conventional religion and morality as cruel and destructive forces. Tess has a pure heart. She is a victim, raped by Alec, but she is morally condemned by her society for being pregnant and unmarried, even though it is not her fault. Her baby, though completely innocent, is denied a burial in the local graveyard by the local priest for being born out of wedlock. Tess has to relocate to work at a dairy away from home to get a fresh start in a place where people will not know she is a fallen woman.
Angel's sense of conventional morality moves him to condemn Tess after she tells him about Alec; this contributes to her destruction. Again, although her heart is pure, he cannot see past the fact that she is not a virgin. He also, very conventionally and hypocritically, finds it permissible for a male to be sexually experienced but not a woman.
Hardy's point is that the kindest of people, like Tess, can stray from the conventional moral path through no fault of their own. It is the rigid moral code that is at fault, not the person, like Tess, who violates it without wanting to. Society is too judgmental. Religion functions punitively when perhaps it should show forgiveness.
There is no poetic justice in Tess of the d'Urbervilles because, for Hardy at least, the universe is a place of random coincidence and not a place ruled by a benign God who will make everything turn out all right in the end.