Motivated by a recent experiment by Zelevinsky et al. [Phys. Rev. Lett. 96, 203201], we present the theory for photoassociation and optical Feshbach resonances of atoms confined in a tight one-dimensional (1D) or two-dimensional (2D) optical lattice. In the case of an alkaline-earth intercombination resonance, the narrow natural width of the line makes it possible to observe clear manifestations of the dimensionality, as well as some sensitivity to the scattering length of the atoms. Among possible applications, a 2D lattice may be used to increase the spectroscopic resolution by about one order of magnitude. Furthermore, a 1D lattice induces a shift which provides a new way of determining the strength of a resonance by spectroscopic measurements.