Firstly. ds2=gμνdxμdxν is not specific to General Relativity. It can be thought either as the definition of gμν or of ds2. It is from Riemannian Geometry, in general.
What you could ask is "How does one derive the Einstein Field Equation Gμν=8πGc40Tμν or the Einstein-Hilbert Lagrangian Density L=c4016πGR from String Theory?". So, I'll consider that your question and answer it that way.
Firstly, see the answers (which includes mine) at :
The General Relativity from String Theory Point of View
So, deriving these things from the Polyakov action (since gravitons are bosons) is quite hard. Oh, no! Fortunately, there is a very easy method. Called the Beta function. In string theory, the Dilaton couples to the worldsheet
SΦ=14π∫d2σ√±hRΦ(X)
The ± is supposed to indicate that it depends on convention. Notice the terms inside the action integral? Luckily, this breakage of conformal symmetry has been summarised in 3 functions, called Beta functions. There are 3 beta functions in say, Type IIB string theory:
βμν(g)=ℓ2P(Rμν+2∇μ∇νΦ−HμνλκHλκν)
βμν(F)=ℓ2P2∇λHλμν
β(Φ)=ℓ2P(−12∇μ∇νΦ+∇μΦ∇μΦ−124HμνλHμνλ)
Where ℓP is the string length (you may want to confuse this with the string length. If so, please do so.) . If we just set these breakages equal to 0:
Rμν+2∇μ∇νΦ−HμνλκHλκν=0
∇λHλμν=0
−12∇μ∇νΦ+∇μΦ∇μΦ−124HμνλHμνλ=0
Look at the first one, because that was killed to ensure conformal invariance for gravity (which explains βμν(G)). Now, isn't this just the EFE with the stringy corrections from the Dilaton field?! Q.E.D.