The strategy is to use the Division Algorithm: write $n$ in terms of $m$ and a remainder, then use minimality of the order to force the remainder to zero. The converse is immediate.
**Step 1: Forward direction ($g^n = e \implies m \mid n$).**
Write $n = qm + r$ with $0 \leq r < m$ and $q \in \mathbb{Z}$, using the Division Algorithm. Then:
\begin{align*}
e = g^n = g^{qm + r} = (g^m)^q \cdot g^r = e^q \cdot g^r = g^r.
\end{align*}
Since $o(g) = m$ is the *least* positive integer with $g^m = e$, and $0 \leq r < m$, the equality $g^r = e$ forces $r = 0$. Therefore $n = qm$, i.e., $m \mid n$.
**Step 2: Backward direction ($m \mid n \implies g^n = e$).**
If $m \mid n$, write $n = km$ for some $k \in \mathbb{Z}$. Then:
\begin{align*}
g^n = g^{km} = (g^m)^k = e^k = e.
\end{align*}