Religion drives two things in particular in this novel.
First, religion and religious ideas initially define Jude's self-image and later his ambition. The moral precepts of Christianity also form Jude's uncritical moral views until Sue has a chance to convince him that these views do not allow for the honest pursuit of one's truest life (if that life does not include marriage or if it means divorce, etc.).
In the first three sections of the novel, Jude occassionally makes biblical references and also pursues a religiously founded education (for a time). He also gets most of his work as a stone mason in religious contexts - in churches.
Jude has been trained to reconstruct Gothic, medieval churches. Hardy placed great value in historical preservation, believing urbanization to be the source of the destruction of the rural past.
Religion also drives the moral vision of the society of England at large. It is this vision that Jude finally rebels against, to some degree, and which Sue chafes against constantly, begining with her purchase of two Roman statues. These statues are then smashed by the house mother where Sue is staying, symbolizing the nature of the conflict: the honest feelings of the individual are destroyed if they do not conform to the widely held moral feelings of society.
Even Phillotson, a quite conventional man, finds that he is forced to go against the views of society at large. He is defeated.
It is religion, as a general body of ideas, that represents and codifies the moral views of the society depicted in the novel. It is religion, ironically and symbolically, that lands the fatal blow against Jude and Sue when they are run out of town while working on a job re-furbishing the ten commandments.
The most significant aspect of the pervasive religious moral view of the day is the view of marriage. The novel's central interest is marriage, the inflexibility of the institution, and the effects of marriage on the spirits of those who are married.