In the 19th century, divorce laws were very restrictive. At the time that Hardy was writing, a man would have had to prove his wife had been unfaithful in order to secure a divorce. As Tess's affair with Alec happened before she and Angel got married, it would not be grounds for divorce.
Nevertheless, men had it easier than women when it came to divorce laws. While infidelity was sufficient grounds for a husband to divorce his wife, it did not allow a woman to divorce her husband. A husband had to have committed incest, bigamy or cruelty, or to have deserted his wife, for the courts to grant her a legal separation.