Both of these novels deal with crimes. In Mayor of Casterbridge, Henchard sells his wife and daughter and lies about it and hides from it for years. In Great Expectations, Pip hides from the guilt of his "crime" (that of stealing food, giving it to a convict and helping that convict escape) for many years as well.
Guilt is another theme shared by both novels. The guilt of both Henchard and Pip becomes a driving and destructive force in each of their lives.
Ambition is another theme shared by both novels. In Mayor of Casterbridge, Henchard's ambition to give up drink and make something of himself becomes his "raison d'etre". The problem is, though, that he is a hypocrite, so his ambition is not a redeeming quality but one that consumes him in order to purge himself of guilt. That is why in the end, he is destroyed. Pip, on the other hand, is ambitious to fulfill his "expectations", but his heart is good, unlike Henchard, and in the end, although things don't work out exactly as he has expected, he emerges more victoriously than Henchard. He has people that love and care for him. Henchard does not.
Both novels were written in the 1800s and have naturalistic themes -- i.e. man's struggle against nature, man's struggle against society, man's struggle against himself. Naturalistic authors were influenced by the ideas of Darwin and both Dickens and Hardy's works presented man in his naturalistic environment.
Read the analysis of both novels here on enotes. Also read about naturalism in literature here on enotes.
Both of these stories share a theme of family, and the fact that the characters themselves did not value family more than wealth. Their families are alienated, or driven away, (or "sold"), and the characters, in the end, greatly regret their actions. Both Pip and Michael regret their poor treatment of their families, and seek reconciliation and and forgiveness from them in the end. They realize that it is the family that gives true happiness. It's a valuable lesson that they both learn the hard way.
Both stories also share the theme of pride; the main characters have pride in themselves and their position in life, and that pride, as the old saying states, goes before the fall. They end up losing much of their wealth, and left dealing with the repercussions of bad decisions and treatment of others. Pride is something that does not do either man any good.
Another similarity is that both novels span a great amount of time; "The Mayor of Casterbridge" is one that covers over 20 years, as does "Great Expectations." We see the entire scope of the repercussions of their actions, and how things resolve themselves in the end. Pip's ending is a bit happier than Michael's, but both stories have them taking a long, long journey towards finding that happiness.
Those are just a few similarities to get you started; I hope that helped! Good luck!