A theoretical derivation of two-photon absorption (2PA) from semiconductors, based on the length gauge analysis and the electron density operator, is formulated; the intraband ${\mathbit{r}}_{i}$ part and the interband ${\mathbit{r}}_{e}$ part of the position operator $\mathbit{r}$ are properly accounted for. Within the independent-particle approximation, the nonlinear third-order susceptibility tensor ${\ensuremath{\chi}}^{\mathrm{a}\mathrm{b}\mathrm{c}\mathrm{d}}(\ensuremath{-}\ensuremath{\omega};\ensuremath{-}\ensuremath{\omega},\ensuremath{-}\ensuremath{\omega},\ensuremath{\omega})$ and the two-photon absorption coefficient are calculated, including the scissors correction needed to correct the well-known underestimation of the local-density-approximation band gap. Using time-reversal symmetry, it is shown that the expression for ${\ensuremath{\chi}}^{\mathrm{a}\mathrm{b}\mathrm{c}\mathrm{d}}(\ensuremath{-}\ensuremath{\omega};\ensuremath{-}\ensuremath{\omega},\ensuremath{-}\ensuremath{\omega},\ensuremath{\omega})$ is finite at $\ensuremath{\omega}=0$, avoiding nonphysical divergences presented in previous calculations when $\ensuremath{\omega}\ensuremath{\rightarrow}0$. Ab initio band structure calculations using different pseudopotential schemes that include spin-orbit coupling are used to calculate the 2PA for several semiconductors, and the calculations are compared with available experimental results for photon energies that are below the optical band gap.