$\def\Z{\mathbb Z}$ First suppose that there is a ring morphism $\phi\colon\Z/n\Z \to \Z/m\Z$. Then $0= \phi(0) = \phi(n \cdot 1) = n \cdot \phi(1) = n$, hence $n + m\Z = 0$, which gives $m \mid n$.
If on the other hand $m \mid n$, define $\phi\colon \Z/n\Z \to \Z/m\Z$ by $\phi(a + n\Z) = a + m\Z$, this is well defined: If $a + n\Z = b+n\Z$, then $n \mid a-b$, hence $m \mid a-b$, so $a + m\Z = b+m\Z$. Obviously $\phi$ is a homomorphism.