The optical properties of semiconductor quantum wells embedded in one-dimensional photonic crystal structures are analyzed by a self-consistent solution of Maxwell's equations and a microscopic many-body theory of the material excitations. For a field mode spectrally below the photonic band edge it is shown that the optical absorption and gain are enhanced, exceeding by more than 1 order of magnitude the values of a homogeneous medium. For the photonic crystal structure inside a microcavity the gain increases superlinearly with the number of wells and for more than five wells exceeds the gain of a corresponding vertical-cavity surface-emitting laser.