From the reaction, we know that 2 moles of Mg (s) react with 1 mol of O2
STP conditions mean:
absolute temperature of 273.15 K
absolute pressure of 1 atm
Using the equation of state for ideal gases:
PV = nRT
where P is the absolute pressure, T is the absolute temperature, n are the moles, V is the volume, and R is the gas constant = 0.082 atm*L/(mol*K). Solving for V and replacing: