Solution to Abstract Algebra by Dummit & Foote 3rd edition Chapter 2.3 Exercise 2.3.16
Let $G$ be a group with $x,y \in G$. Assume $|x| = n$ and $|y| = m$. Suppose that $x$ and $y$ commute; i.e., that $xy = yx$. Prove that $|xy|$ divides the least common multiple of $m$ and $n$. Need this be true if $x$ and $y$ do not commute? Give an example of commuting elements $x$ and $y$ such that the order of $xy$ is not equal to the least common multiple of $|x|$ and $|y|$.
Solution: Supposing that $xy = yx$, we saw in a previous theorem that $(xy)^k = x^ky^k$ for all k. In particular, $$(xy)^{\mathsf{lcm}(|x|,|y|)} = (x^{|x|})^{|y|/\mathsf{gcd}(|x|,|y|)} (y^{|y|})^{|x|/\mathsf{gcd}(|x|,|y|)} = 1.$$ Thus by a previous exercise, $|xy|$ divides $\mathsf{lcm}(|x|,|y|)$.
Consider $S_3$. Note that $|(1\ 2)| = |(1\ 3)| = 2$, so that $\mathsf{lcm}(|(1\ 2)|, |(1\ 3)|) = 2$. However $(1\ 2)(1\ 3) = (1\ 3\ 2)$ has order $3$, and $3$ does not divide $2$.
For a trivial example, consider $x \neq 1$ and let $y = x^{-1}$. Less trivially, consider $(x,y),(1,y) \in Z_2 \times Z_4$, where $Z_2 = \langle x \rangle$ and $Z_4 = \langle y \rangle$. Note that $$|(x,y)(1,y)| = |(x,y^2)| = 2,$$ while $$|(x,y)| = |(1,y)| = 4. $$Thus $$|(x,y)(1,y)| \neq \mathsf{lcm}(|(x,y)|,|(1,y)|).$$