We have investigated the structural, electronic, and magnetic properties of MgO nanolayers with two different nanolayer thicknesses (1.5 nm and 1.75 nm) on a Fe substrate. The calculated results in this paper were obtained using the density functional theory (DFT) within the generalized gradient approximation (GGA). The total energies as a function of volume are calculated and thereby the lattice parameters, bulk moduli of MgO nanolayers with two different thicknesses have been calculated. The effects of surface atoms and Fe substrate atoms on physical properties of these nanolayers have been analyzed using the calculated total and partial electron density of states in its ferromagnetic phase. The spin-polarized density of states of MgO shows that this compound is an insulator in the nonmagnetic phase. MgO nanolayers on Fe substrate are metal in the ferromagnetic phase. The magnetic properties of surface atoms and Fe substrate atoms have been investigated and compared with bulk. Furthermore, the effect of hydrostatic pressure on the total and local magnetic moment of these nanolayers has been investigated.