We present time-resolved optical spectroscopy of the afterglows of the gamma-ray bursts GRB 990510 and GRB 990712 . Through the identification of several absorption lines in the first epoch GRB 990510 spectrum , we determine the redshift for this burst at z \geq 1.619 . No clear emission lines are detected . The strength of the Mg i feature is indicative of a dense environment , most likely the host galaxy of GRB 990510 . Although the host is extremely faint ( V \mathrel { \hbox { \hbox to 0.0 pt { \lower 2.365 pt \hbox { $ \sim$ } } \kern 0.0 pt \raise 1. % 72 pt \hbox { $ > $ } } } 28 ) , the GRB afterglow allows us to probe its interstellar medium and – in principle – to measure its metallicity . The optical spectrum of GRB 990712 ( whose host galaxy is the brightest of the known GRB hosts at cosmological redshifts ) , shows clear features both in emission and absorption , at a redshift of z = 0.4331 \pm 0.0004 . On the basis of several line emission diagnostic diagrams , we conclude that the host galaxy of GRB 990712 is most likely an H ii galaxy . We derive a unreddened [ O ii ] star formation rate of 2.7 \pm 0.8 M _ { \odot } yr ^ { -1 } . Correcting for the measured extinction intrinsic to the host galaxy ( A _ { V } = 3.4 ^ { +2.4 } _ { -1.7 } ) , this value increases to 35 ^ { +178 } _ { -25 } M _ { \odot } yr ^ { -1 } . The [ O ii ] equivalent width , compared to that of field galaxies at z \leq 1 , also suggests that the host of GRB 990712 is vigorously forming stars . We employ the oxygen and H \beta emission-line intensities to estimate the global oxygen abundance for the host of GRB 990712 : log ( O/H ) = –3.7 \pm 0.4 , which is slightly below the lowest metallicity one finds in nearby spiral galaxies . For both GRBs we study the time evolution of the absorption lines , whose equivalent width might be expected to change with time if the burst resides in a dense compact medium . We find no evidence for a significant change in the Mg ii width .