A group such that $a^m b^m = b^m a^m$ and $a^n b^n = b^n a^n$ ($m$, $n$ coprime) is abelian?
Let $M \subset G$ be the subgroup generated by all $m$-th powers and let $N \subset G$ be the subgroup generated by all $n$-th powers. These subgroups are clearly abelian normal subgroups. Since $m$ and $n$ are coprime, $G = MN$, and hence $M \cap N$ is contained in the center $Z(G)$ of $G$. To prove that $G$ is abelian it suffices to show that $M$ and $N$ commute, that is $[M,N]=1$. Note that $[M,N] \subset M \cap N$ (since $M$ and $N$ are normal subgroups). Let $a \in M$ and $b \in N$. Then $[a, b] = a^{−1}b^{−1}ab \in M \cap N$. Hence $[a, b] = z$ with $z \in Z(G)$. Hence $b^{−1}ab = za$, whence $b^{−1}a^nb=z^na^n$. Since $a^n \in N$ it commutes with $b$, so $z^n=1$. Similarly $z^m=1$. Since $m$ and $n$ are relatively prime, we conclude $z=1$.
Write $mk+nl=1$ for some $k,l\in\mathbb Z$.
We have
$$\begin{align} ab&=a^{mk+nl}b^{mk+nl}\\ &=a^{mk}(a^{nl}b^{mk})b^{nl}\\ &\stackrel{(*)}=a^{mk}(b^{mk}a^{nl})b^{nl}\\ &=(a^{mk}b^{mk})(a^{nl}b^{nl})\\ &=(b^{mk}a^{mk})(b^{nl}a^{nl})\\ &=b^{mk}(a^{mk}b^{nl})a^{nl}\\ &\stackrel{(**)}=b^{mk}(b^{nl}a^{mk})a^{nl}\\ &=(b^{mk}b^{nl})(a^{mk}a^{nl})\\ &=b^{mk+nl}a^{mk+nl}\\ &=ba, \end{align}$$
where we used $$a^{nl}b^{mk}=b^{mk}a^{nl}\qquad(*)$$ and $$a^{mk}b^{nl}=b^{nl}a^{mk}\qquad(**)$$
Let's prove $(*)$ and $(**)$:
$$\begin{align} (a^mb^n)^{mk}&=a^m(b^na^m)^{mk-1}b^n\\ &=a^m(b^na^m)^{mk}a^{-m}, \end{align}$$
which implies
$$(a^mb^n)^{mk}a^m=a^m(b^na^m)^{mk}\\ \Rightarrow a^m(a^mb^n)^{mk}=a^m(b^na^m)^{mk},$$ hence $$(a^mb^n)^{mk}=(b^na^m)^{mk}.\qquad(\sharp)$$
Similarly we get $$(a^mb^n)^{nl}=(b^na^m)^{nl}.\qquad(\sharp\sharp)$$
Multiplying $(\sharp)$ and $(\sharp\sharp)$ we obtain $a^mb^n=b^na^m$.
Proceeding in the same way we get $a^nb^m=b^ma^n$
An easy induction shows now $(*)$ and $(**)$.