To have emission (or absorption) of photons you must have a Hamiltonian that includes those degrees of freedom also. If your system consists of (a) the electromagnetic field and (b) a hydrogen atom, you can specify the state with (a) for each frequency, the number of photons with that frequency and (b) the state of the hydrogen atom, in your favorite way, for example $1s$ or $2p$. You could write $\vert n_\omega=1, 1s\rangle$ for a state with 1 photon of frequency $\omega$ and the atom in the state 1s.
To calculate the probability for a transition between the states $\vert i\rangle$, meaning no photons and hydrogen atom in initial state $i$, and $\vert n_\omega =1, f\rangle$ where $f$ is some final state, you need to calculate an inner product like $$P = \langle n_\omega =1, f|O|i\rangle$$ where $O$ is some operator. The probability for the transition is then something proportional to $|P|^2$. The most significant contribution comes from the electric dipole moment operator and this is a standard calculation in textbooks. The result is that $P$ is proportional to $$P\propto \frac{\sin(t(\omega + \omega_f - \omega_i)/2)}{(\omega + \omega_f - \omega_i)/2}$$ where $\omega_f, \omega_i$ are the related to the initial and final energies by $\hbar\omega_f = E_f$ and similarly for $i$, and $t$ is the elapsed time. Clearly $P$ can be non-zero even if energy isn't conserved.
However, in the limit $t \to \infty$, $|P|^2$ approaches something proportional to $t\delta(\omega + \omega_f - \omega_i)$ where the $\delta$ is a Dirac delta. This is where conservation of energy comes from. The statement that atoms can emit photons only at specific frequencies is false if taken literally, each spectral line comes with a natural width corresponding to that $P$ for finite $t$ is non-zero even away from $\Delta E = 0$.
You can find a detailed calculation of $P$ in any textbook on quantum mechanics. I learned from Townsend's A Modern Approach to Quantum Mechanics, but I think you will find this calculation Sakurai's or Griffiths's books also.