It is shown that the resonant states (RSs) in the quantum scattering theory and electromagnetics have a common nature: in one-dimensional setting, they are associated with complex eigenvalues of the nonselfadjoint Sturm–Liouville problems on the line that give rise to singularities of the analytical continuation to the complex domain of the solution, scattering matrices, and finally the scattered fields. For a homogeneous dielectric slab situated in free space, in a rectangular waveguide with perfectly conducting (PEC) walls, or between two parallel PEC planes, the dispersion equations (DEs) for eigenvalues coincide with those obtained in the quantum scattering problems involving rectangular barriers or single or multiple rectangular quantum wells. The existence of infinite sets of complex DE zeros is proved which explains the known oscillatory behaviour of the transmission coefficients and provides fundamental knowledge about the background of resonance phenomena.