Magnesium plays a critical role in the formation of chlorophyll, the green pigment responsible for photosynthesis in plants. It acts as a central atom in the chlorophyll molecule, allowing it to capture light energy efficiently and convert it into chemical energy. This process is vital for plant growth and the overall ecosystem, as it supports the food chain and oxygen production.