TL;DR Excitation of an electron typically conserves spin; that is to say, the spin must be left unchanged by the process. If the initial state has no net spin (one spin-up and one spin-down electron), then the final state should also have no net spin (one spin-up and one spin-down electron). This rule is reliable for small-ish atoms, but often breaks down with heavier atoms.
Note that this doesn't prescribe which electron gets excited (spin-up or spin-down); in general we can't say anything about that.
The reason is to do with Fermi's golden rule. The transition probability is governed by a quantum mechanical integral (the "transition dipole moment") which looks like
$$\langle \psi_\text{final} | \hat{H} | \psi_\text{initial} \rangle.$$
Here, $\psi_\text{initial}$ and $\psi_\text{final}$ are the initial and final states respectively, and $\hat{H}$ is the perturbation Hamiltonian. For an electromagnetic wave process this is the dipole moment operator $\hat{\mu}$, which can be expressed in terms of the position operators:
$$\hat{\mu} = \mu_x\hat{x} + \mu_y\hat{y} + \mu_z\hat{z}$$
The key things to note are that:
- The electron wavefunctions $\psi$ can typically be factorised into a spatial part and a spin part, which I denote as $\phi$ and $\chi$ respectively:
$$\begin{align}
|\psi_\text{final}\rangle &= |\phi_\text{final}\rangle \cdot |\chi_\text{final}\rangle, \\
|\psi_\text{initial}\rangle &= |\phi_\text{initial}\rangle \cdot |\chi_\text{initial}\rangle. \\
\end{align}$$
- The perturbation Hamiltonian $\hat{H} = \hat{\mu}$ only depends on spatial degrees of freedom, and not spin.
Therefore, the transition dipole moment can be factorised into a spatial part and a spin part:
$$\begin{align}
\langle \psi_\text{final} | \hat{H} | \psi_\text{initial} \rangle &= \langle \phi_\text{final}\chi_\text{final} | \hat{\mu} | \phi_\text{initial}\chi_\text{initial} \rangle \\
&= \langle \phi_\text{final} | \hat{\mu} | \phi_\text{initial} \rangle \langle \chi_\text{final} | \chi_\text{initial} \rangle
\end{align}$$
In particular, the spin part $\langle \chi_\text{final} | \chi_\text{initial} \rangle$ is zero, and hence the transition probability is zero, unless the initial and final states have the same spin. Processes which involve spin flips are often called "spin-forbidden".
Under certain conditions, the assumption (1) breaks down: that is to say, the wavefunction $\psi$ cannot be cleanly factorised into spatial and spin parts $(\phi, \chi)$. This happens particularly when spin–orbit coupling is present: heavier elements (i.e. elements with larger atomic number) typically exhibit greater spin–orbit coupling.
Thus, for light atoms like hydrogen, spin-forbidden processes are genuinely "forbidden", and therefore almost never happen. However, so-called "spin-forbidden" processes can actually happen for heavier atoms. Some examples include:
the pale pink colour of $\ce{Mn^2+}$ salts results from a spin-forbidden excitation process. The fact that it is spin-forbidden just means that the colour is a lot weaker than that of a typical transition metal. There is a lot more discussion of this particular case at Why is manganese(II) coloured although the transition should be spin-forbidden?.
the purple colour of iodine $\ce{I2}$ results from a singlet to triplet excitation. The fact that this colour is pretty intense (as opposed to the pale pink of $\ce{Mn^2+}$ simply reflects the fact that iodine has a large atomic number.