Isothermal static compression data for MgO at 300 and 1100 K were obtained by combining synchrotron X-ray diffraction techniques with an externally heated high-temperature diamond-anvil cell that is capable of achieving pressures greater than 125 GPa at temperatures up to 1100 K. The experiments at 300 K were conducted under both hydrostatic and nonhydrostatic conditions. The deviatoric stress in non-hydrostatic environment significantly effects the measured lattice parameters. Fits to the static compression data of MgO at 300 K yield a bulk modulus of 185(7) GPa and 160(2) GPa under nonhydrostatic and hydrostatic conditions, respectively. The deviatoric stress decreases with increasing temperature, and a nearly hydrostatic condition was achieved at temperatures above 900 K when NaCl was used as a pressure-medium. The bulk modulus of MgO was determined to be 135(3) GPa at a temperature of 1100 K, yielding its temperature derivative of -0.030(3) GPa/K. Comparing these results with previous studies in the system MgO-FeO, shows that the bulk modulus of (Mg,Fe)O decreases with increasing FeO content, from 160 GPa for MgO to 146 GPa for FeO.