Magnesium sulphate can be prepared by neutralizing magnesium carbonate or the oxide with sulphuric acid.
MgCO3 + H2SO4 = MgSO4 + CO2 + H2O
MgO + H2SO4 = MgSO4 + H2O
On evaporation of the solution, white crystals of MgSO4.7H2O (epsom) will be obtained.
NOTE:
Mg + H2SO4 → H2 + MgSO4
As we know that metal, metal oxide and metal carbonate reacts with acids to produce salts. When you want magnesium sulfate salts in lab use magnesium oxide and magnesium carbonate to prepare magnesium sulfate salts, because magnesium reacts with sulfuric acids to produce hydrogen gas and that is very dangerous because it explode easily.