According to answers to this Math Overflow question, there is an infinite rank abelian group $A$ such that $A\cong A^3$ but $A\not\cong A^2.$ Clearly $A$ is an retract of $A^2$ while $A^2$ is an retract of $A^3\cong A$. Therefore, $A$ and $A^2$ are non-isomorphic groups which are retracts of each other.

Are there two finitely presented groups $G$ and $H$, such that $G\not \cong H$ which are retracts of each other?

Thank you in advance.

there exist two non-isomorphic finitely presented groups that are quotient of each other(this is a bit weaker than being retracts of each other). Indeed, take $G=BS(2,3)$ (Baumslag-Solitar): it's isomorphic to a quotient $G/N$, where $N$ is a nontrivial free group. Therefore, if $x$ belongs to a basis of $N$ and $M$ is the normal subgroup of $G$ generated by $x^2$, the quotient $G/M$ has an element of order 2 (the image of $x$), and $G$ and $G/M$ are isomorphic to quotients of each other. Since $G$ is torsion-free, it is not isomorphic to $G/M$. $\endgroup$ – YCor Oct 4 '17 at 16:27