  We present 65 Sloan Digital Sky Survey (SDSS) spectra of 62 star-forming
galaxies with oxygen abundances 12 + logO/H ~ 7.5-8.4. Redshifts of selected
galaxies are in the range z~0.36-0.70. This allows us to detect the redshifted
MgII 2797,2803 emission lines. Our aim is to use these lines for the magnesium
abundance determination. The MgII emission was detected in ~2/3 of the
galaxies. We find that the MgII 2797 emission-line intensity follows a trend
with the excitation parameter x= O^{2+}/O that is similar to that predicted by
CLOUDY photoionised HII region models, suggesting a nebular origin of MgII
emission. The Mg/O abundance ratio is lower by a factor ~2 than the solar
ratio. This is probably the combined effect of interstellar MgII absorption and
depletion of Mg onto dust. However, the effect of dust depletion in selected
galaxies, if present, is small, by a factor of ~2 lower than that of iron.
