This argument was suggested by Jyrki Lahtonen in the comments. (I'm sure Jyrki would have expressed it in a much nicer way.)
Abelian groups will be written multiplicatively. For each positive integer $n$ let $C_n$ be a cyclic group of order $n$. For any finite abelian group $A$ and any positive integer $k$, let $f_k(A)$ be the number of elements of $A$ whose order divides $k$ (or, if you prefer, the number of $k$th roots of $1$ in $A$). Then we have $f_k(A\times B)=f_k(A)f_k(B)$. Moreover, $f_k(C_n)$ is equal to $k$ if $k$ divides $n$, and to $1$ otherwise.
Our two finite abelian groups, $A$ and $B$ say, clearly satisfy $f_k(A)=f_k(B)$ for all $k$. By the classification theorem, we have $A\simeq C_{m(1)}\times\cdots\times C_{m(r)},\quad B\simeq C_{n(1)}\times\cdots\times C_{n(s)}$ with $m(1)\ |\ \cdots\ |\ m(r)$ and $n(1)\ |\ \cdots\ |\ n(s)$ (where $|$ means "divides"). We have $m(r)=n(s)$ (take $k=m(r)$ and $k=n(s)$), and an obvious induction completes the proof.