We investigate the lattice dynamical and dielectric properties of MgO single crystals and powders by measurements in the mid- and far-infrared frequency region under high pressures, ranging up to 21.7 GPa. The shift of the restrahlen region is used to determine the pressure dependence of the transverse and longitudinal optical modes. The analysis of the refractive index in the mid- and far-infrared region allowed us to obtain the pressure behavior of the static and electronic dielectric constants. The transverse effective charge slowly decreases under high pressure, reflecting the stability of MgO. As a consequence, the pressure dependence of the static and electronic dielectric constants is mainly determined by the pressure dependence of the polar phonon frequency and Penn gap, resulting in a pronounced decrease of the former and a moderate decrease of the latter.