In a single-electron atom, due to the spin of the electron \(\mathbf{s}\), it also has a magnetic moment $$\mathbf{\mu}_s=-\frac{ge}{2m}\mathbf{s},$$
where \(g\approx 2\) is the gyromagnetic ratio. Now the electron is moving in the electric field of the nucleus, so it experiences a magnetic field in its moving frame which interacts with \(\mathbf{\mu}_s\). Classically, the magnetic field seen by the electron is
$$\mathbf{B}=-\frac{1}{c^2}\mathbf{v}\times\mathbf{E}=-\frac{1}{ec^2}\mathbf{v}\times\nabla V(r),$$
where \(\mathbf{v}\) is its velocity vector, \(\mathbf{E}\) is the electric field, and \(V(r)=-\frac{Ze^2}{4\pi\varepsilon_0r}\). This magnetic field interacts with the spin magnetic moment: the spin-orbit interaction.
Since there is no external torque on the atom itself, a coupling between the orbital angular momentum \(\mathbf{l}\) and spin \(\mathbf{s}\) must result in a total angular momentum \(\mathbf{j}\), where \(|\mathbf{j}|\) and \(\mathbf{j}_z\) are constant. However, if placed in the magnetic field, \(\mathbf{j}\) therefore precesses around the \(z\)-axis due to the torque
$$\mathbf{\tau}=\mathbf{\mu}\times\mathbf{B}=-\frac{e}{m}\mathbf{j}\times\mathbf{B}.$$
Likewise, \(\mathbf{s}\) and \(\mathbf{l}\) precess around \(\mathbf{j}\). This also implies that \(\mathbf{s}_z\) and \(\mathbf{l}_z\) are no longer constant, so \(m_s\) and \(m_l\) are no longer suitable quantum numbers. Instead, we introduce the total angular momentum quantum number \(j=s+l\) and the corresponding secondary number \(m_j\) that takes values \(-j,\dots,j\) in integer steps.