Simple examples are given by free products, assuming you know the normal form for a free product; otherwise, I'm not really saying much.
If you want a more concrete example, take the $2\times 2$ matrices with coefficients in $\mathbb{Q}$, and
$$a = \left(\begin{array}{cc}0&1\\1&0\end{array}\right),\qquad b=\left(\begin{array}{cc}0 & 2\\\frac{1}{2}& 0\end{array}\right).$$
Then $a^2=b^2=1$, but
$$ab = \left(\begin{array}{cc}\frac{1}{2} & 0 \\0 & 2\end{array}\right)$$
has infinite order.
If $a$ and $b$ commute, with $\mathrm{ord}(a)=m$ and $\mathrm{ord}(b)=n$, then you can do better than Wikipedia. We have that:
$$\frac{\mathrm{lcm}(m,n)}{\mathrm{gcd}(m,n)}\quad\text{divides}\quad \frac{\mathrm{lcm}(m,n)}{|\langle x\rangle\cap\langle y\rangle|}\quad\text{divides}\quad \mathrm{ord}(ab)\quad\text{divides}\quad \mathrm{lcm}(m,n).$$
For example, if for every prime $p$ that divides $\mathrm{lcm}(m,n)$, the highest power of $p$ that divides $m$ is different from the highest power of $p$ that divides $n$, then $\mathrm{ord}(ab)=\mathrm{lcm}(m,n)$.
If you are willing to impose global conditions (conditions on $G$), then for example Easterfield proved in 1940 that if $G$ is a $p$-group of class $c$, $a$ has order $p^{\alpha}$, and $b$ has order $p^{\beta}$, then the order of $ab$ is at most $p^m$, where
$$ m = \max\left\{\alpha,\beta+\left\lfloor\frac{c-1}{p-1}\right\rfloor\right\}.$$
From this you can get similar results for a finite nilpotent group (which is necessarily a product of $p$-groups), and hence for the product of two elements of finite order in any nilpotent group (or in fact, in any locally nilpotent group, or even more strongly, in any group in which the 2-generated subgroups are nilpotent).
For $C_6$, observe that $\gamma_C(1)=1$, $\gamma_C(2)=1$, $\gamma_C(3)=2$ and $\gamma_C(6)=2$.
The order of an element $(a,b)$ with $a,b\in C_6$ is the lcm of their respective orders and hence is again a divisor of $6$.
Therefore we have $\gamma_G(1)=\gamma_C(1)^2=1$ as $(a,b)$ has order $1$ iff both $a$ and $b$ have order $1$.
For bigger orders $m$ it seems easier to compute the number of pairs $(a,b)$ that have order that is a divisor of $m$ (instead of exactly $m$).
For example, $(a,b)$ has order dividing $2$ (i.e. equal to $1$ or $2$) iff both $a$ and $b$ have order dividing $2$ (i.e. equal to $1$ or $2$). Thus we conclude $$\begin{align}
\gamma_G(1)&=&\gamma_C(1)^2&=&1\\
\gamma_G(2)+\gamma_G(1)&=&(\gamma_C(2)+\gamma_C(1))^2&=&4\\
\gamma_G(3)+\gamma_G(1)&=&(\gamma_C(3)+\gamma_C(1))^2&=&9\\
\gamma_G(6)+\gamma_G(3)+\gamma_G(2)+\gamma_G(1)&=&(\gamma_C(6)+\gamma_C(3)+\gamma_C(2)+\gamma_C(1))^2&=&36&.\end{align}$$
Solving these equations, we obtain therefore $\gamma_G(1)=1$, $\gamma_G(2)=3$, $\gamma_G(3)=8$, $\gamma_G(6)=24$.
Best Answer
Let $r$ be such that $(gh)^r = 1$. Then $1 = (gh)^{rm} = g^{rm}h^{rm} = h^{rm}$, and so $n\mid rm$ and thus $n\mid r$. Similarly you can show that $m\mid r$, and combining these results gives $mn\mid r$.