We report on a thorough optical investigation of BaFe$_2$As$_2$ over a broad spectral range and as a function of temperature, focusing our attention on its spin-density-wave (SDW) phase transition at $T_{SDW}=135$ K. While BaFe$_2$As$_2$ remains metallic at all temperatures, we observe a depletion in the far infrared energy interval of the optical conductivity below $T_{SDW}$, ascribed to the formation of a pseudogap-like feature in the excitation spectrum. This is accompanied by the narrowing of the Drude term consistent with the $dc$ transport results and suggestive of suppression of scattering channels in the SDW state. About 20% of the spectral weight in the far infrared energy interval is affected by the SDW phase transition.