We report diffusion quantum Monte Carlo (DMC) and many-body $GW$ calculations of the electronic band gaps of monolayer and bulk hexagonal boron nitride (hBN). We find the monolayer band gap to be indirect. $GW$ predicts much smaller quasiparticle gaps at both the single-shot $G_0W_0$ and the partially self-consistent $GW_0$ levels. In contrast, solving the Bethe-Salpeter equation on top of the $GW_0$ calculation yields an exciton binding energy for the direct exciton at the $K$ point in close agreement with the DMC value. Vibrational renormalization of the electronic band gap is found to be significant in both the monolayer and the bulk. Taking vibrational effects into account, DMC overestimates the band gap of bulk hBN, while $GW$ theory underestimates it.