As you stated in your question, the effect of an external magnetic field on an atom depends on the magnetic dipole moment of this atom. Before the introduction of spin, the only contributor to the magnetic dipole moment was the orbital dipole magnetic moment: $$ \vec{M}=\vec{M_L}=-\frac{e}{2m_e}\cdot\vec{L}$$ which does not explain the S-G experiment since its eigenvalue can only be zero when L=0. However, with the introduction of spin we now have another contributor: the spin magnetic moment: $$ \vec{M}=\vec{M_L}+\vec{M_S}=-\mu_B\hbar^{-1}(\vec{L}+g_e\vec{S}) $$ Even if L=0, the eigenvalue(s) of $\vec{M}$ will still depend on the value of S and there can thus be several of them, which means your observation (effect of external field B) will also have several possible results which eventually means several deflection angles and splitting of your beam