First principles and quasi-harmonic Debye model have been used to study the thermodynamic properties, enthalpies, electronic and optical properties of MgO up to the core–mantle boundary (CMB) condition (137 GPa and 3700 K). Thermodynamic properties calculation includes thermal expansion coefficient and capacity, which have been studied up to the CMB pressure (137 GPa) and temperature (3700 K) by the Debye model with generalized gradient approximation (GGA) and local-density approximation (LDA). First principles with hybrid functional method (PBE0) has been used to calculate the electronic and optical properties under pressure up to 137 GPa and 0 K. Our results show the Debye model with LDA and first principles with PBE0 can provide accurate thermodynamic properties, enthalpies, electronic and optical properties. Calculated enthalpies show that MgO keep NaCl (B1) structure up to 137 GPa. And MgO is a direct bandgap insulator with a 7.23 eV calculated bandgap. The bandgap increased with increasing pressure, which will induce a blue shift of optical properties. We also calculated the density of states (DOS) and discussed the relation between DOS and band, optical properties. Equations were used to fit the relations between pressure and bandgaps, absorption coefficient (α(ω)) of MgO. The equations can be used to evaluate pressure after careful calibration. Our calculations can not only be used to identify some geological processes, but also offer a reference to the applications of MgO in the future.