You could say that Thomas Hardy's work became more miserable as time went on; however, this is not explicitly true as even his earliest work was riddled with tragedy, including A Pair of Blue Eyes, Hardy's third book, written before his fourth book Far From the Madding Crowd, in which the narrative's heroine, Elfride, is rejected by her fiancé and dies in childbirth (after marrying another man, simply because he found out that she had been engaged to another man before him). This is clearly more heavy on tragedy than the latter book, so it is questionable whether his literature got progressively more tragic; I would say no as it is not consistently worse.
This underlying obsession with brutal realism and tragedy stems from his own deeply unhappy life, specifically his doomed marriage to Emma Gifford. Initially they were happy together, but Emma was a higher social class to the poorer Hardy, which caused a rift in their relationship as Emma began to 'look down on him', including his novels, allegedly saying they were only fit for servants to read. Hardy was so deeply unhappy that he wrote in one statement that "a marriage should be dissolvable as soon as it becomes a cruelty to either of the parties - being then essentially and morally no marriage." This acted as inspiration to many of the terrible relationships in his novels, such as Bathsheba's conflict in choosing between the three suitors and Tess and Alec's toxic marriage.
In 1912, Emma died, and Hardy was driven almost mad with grief (strange, considering their mutual disdain for each other when she was alive) and became the subject for many of his poems, exemplified in The Voice with the grief-stricken opening line of "Woman much missed how you call to me, call to me", and his tragic novels. However, the novels written before he met Emma including A Pair of Blue Eyes, were also tragic, which mars the theory that it was influenced by his personal life. Nevertheless, it can definitely be said that overall his literary subject matter was drawn from his relationship with Emma and her later death.
For more information about Thomas Hardy's personal life, take a look at Claire Tomalin's Thomas Hardy: The Time-Torn Man.