If you are writing an essay, I would first determine some issues that make them similar. For example, they share parentage of Estella (one biological, one adoptive), they both were betrayed by Compeyson, they both are benefactors, and at the end of their lives, both want relief from what they have done wrong in their lives.
Wemmick says of Compeyson, "I can only suppose now that it was a part of his policy, as a very clever man, habitually to decieve his own instruments." This shows Wemmick knows of Compeyson's dealings with many and regularly betrayed them. This is in chapter 55. This meant both Magwitch and Havisham.
Another similarity is that both Magwitch and Havisham note Pip's loyalty: Pip encourages her after she claims, "What have I done?" 6-7 times,
"You dismiss me from your mind and conscience."
in chapter 49. By chapter 56, when Magwitch is dying, he remarks
You've been more comfortable alonger me since I was under a dark cloud than when the sun shone. That's best of all.
There are many connections between the two, you just need to choose what you are going to go with.