These groups are not equivalent. To see this, you can use the theory of one-relator groups. Specifically, a group with a single defining relator contains torsion if and only if the relator is a proper power (Thm 4.12 of Magnus, Karrass and Solitar's book "Combinatorial Group Theory"). That is, supposing $R$ is not a proper power in $F(X)$ then $\langle X; R^n\rangle$ has torsion if and only if $n>1$. Moreover, every element of finite order has order dividing $n$.
Now, $abab=(ab)^2$ so your first group contains torsion. Indeed, it contains elements of order $2$, but of order no more than $2$.
On the other hand, there does not exist $w\in F(a, b)$ such that $w^2=aabb$. This is by a paper of R. Lyndon, "The equation $a^2b^2=c^2$ in free groups", 1959, where he proves that if $w^2=x^2y^2$ in a free group then $[x, y]=1$. Clearly $[a, b]\neq 1$ in $F(a, b)$.
Therefore, one of your groups contains elements of order two while the other does not.
Indeed, there is a paper, "The isomorphism problem for two-generator one-relator groups with torsion is solvable" by Steve Pride (1977) which solves the isomorphism problem for (surprisingly!) two-generator one-relator groups with torsion. It says, $\langle a, b; R^n\rangle\cong \langle a, b; S^m\rangle \Leftrightarrow m=n$ and there exists $\phi \in \operatorname{Aut}(F_2)$ such that $R\phi=S$ (and one can decide if there exists such a $\phi$ by Theorem N2 of Magnus, Karrass and Solitar).
EDIT: Actually, it is perhaps easier just to note that one group is the free product of the infinite cyclic group with the cyclic group of order two, $\mathbb{Z}\ast C_2$, while the other is the fundamental group of the Klein bottle, which is well-known to be torsion-free (and as this is an algebraic topology question, proving that the fundamental group of the Klein bottle is torsion-free is an exercise left to the reader!).