We introduce a method to calculate defect-assisted Shockley-Read-Hall (SRH) recombination rates in imperfect semiconductors from first principles. The method accounts for the steady-state recombination dynamics under given nonequilibrium conditions (split quasi-Fermi levels) by invoking a full solution to the rate equations describing transitions across the band gap via all possible charge states of the defect. Transition rates due to radiative and nonradiative multiphonon emission processes are calculated from first principles. The method is used to evaluate the effect of selected defects on the photovoltaic device parameters of seven emergent photovoltaic semiconductors. These examples clearly highlight the limitations of commonly employed approximations of the recombination dynamics. Our work advances the description and understanding of defect-induced losses in photovoltaics and provides a basis for developing the important concept of defect-tolerant semiconductors and discovering high-performance photovoltaic materials computationally.