You want to construct an isomorphism between $G$ and $H$. Essentially, send $a$ and $b$ to elements of $H$ in a nice way. After some fiddling, we try $a \mapsto cd$, $b \mapsto d^{-1}$. We see that $e = abab^{-1} \mapsto (cd)(d^{-1})(cd)(d^{-1})^{-1} = c^2d^2 = e$, so this is a reasonable candidate.
So it's a homomorphism, but we need to show it is an isomorphism. Clearly $ab \mapsto (cd)(d^{-1}) = c$, and $b^{-1} \mapsto (d^{-1})^{-1} = d$, so it's surjective. But showing injectivity is a pain. Informally, we can use the reasoning above to show that $abab^{-1} \mapsto c^2 d^2$, and those are both zero in their respective groups. In this case it works, but in more complicated presentations, that might not suffice.
If you want a more formal argument, consider these as quotients of the free group on two generators, $F_2 = \langle a,b \mid ~ \rangle$. We consider two subgroups, $K_1 = \langle abab^{-1} \rangle$ and $K_2 = \langle a^2 b^2 \rangle$. By definition, $G \cong F_2/K_1$, and $H \cong F_2/K_2$. We wish to show $F_2/K_1 \cong F_2/K_2$.
Let $\alpha : F_2 \to F_2$ send $a$ to $ab$, and $b$ to $b^{-1}$. This can be uniquely extended to a homomorphism by the universal property of the free group. Interestingly enough, it is its own inverse, so showing it is an isomorphism is easy:
$$ \alpha(\alpha(a)) = \alpha(ab) = \alpha(a) \alpha(b) = abb^{-1} = a$$
$$ \alpha(\alpha(b)) = \alpha(b^{-1}) = \alpha(b)^{-1} = (b^{-1})^{-1} = b$$
It now suffices to show that $\alpha(K_1) = K_2$.* Let $x \in K_1$; it must be $(abab^{-1})^n$. So
$$\alpha(x) = \alpha((abab^{-1})^n) = \alpha(abab^{-1})^n = ((ab)(b^{-1})(ab)(b^{-1})^{-1})^n = (a^2 b^2)^n$$
Reversing this easily shows the reverse containment.
*Because then we can take the natural projection $\pi : F_2 \to F_2 / K_2$, and create $\beta = (\pi \circ \alpha)$, which maps $F_2$ to $F_2 / K_2$, and has kernel $K_1$. This means $\beta$ factors through $K_1$, and we get a well-defined homomorphism $\gamma$. from $F_2 / K_1$ to $F_2 / K_2$. Using $\alpha$'s bijectivity, it's easy to show that $\gamma$ is also bijective.