We examine the effects of stacking sequence and number of layers on the electronic and luminescence properties of hexagonal boron nitride (h-BN) structures with first-principles calculations based on density functional and many-body perturbation theory. We explored the variations of the magnitude and character (direct or indirect) of the quasiparticle bandgap and interband optical matrix elements for bulk, bilayer, and monolayer stacking polytypes. Although the fundamental gap for most structures is indirect, phonon-assisted transitions are strong (typically 600 times stronger than bulk Si) and enable efficient deep-ultraviolet (UV) luminescence. The polarization of the emitted light is transverse electric, which facilitates light extraction perpendicularly to the h-BN basal plane. Random stacking in turbostratic BN breaks the crystal symmetry and enables optical transitions across the quasi-direct bandgap, albeit with a weak matrix element. Our results demonstrate that h-BN is a promising material for efficient deep-UV light emitters.