Firstly. $\mbox ds^2=g_{\mu\nu}\mbox dx^{\mu}\mbox dx^{\nu}$ is not specific to General Relativity. It can be thought either as the definition of $g_{\mu\nu}$ or of $\mbox ds^2$. **It is from Riemannian Geometry, in general.**

What you could ask is "How does one derive the Einstein Field Equation $G_{\mu\nu}=\frac{8\pi G}{c_0^4}T_{\mu\nu}$ or the Einstein-Hilbert Lagrangian Density $\mathcal L = \frac{c_0^4}{16\pi G}R$ 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_\Phi = \frac1{4\pi} \int d^2 \sigma \sqrt{\pm h} R \Phi(X)$$

The $\pm$ 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:

$${\beta _{\mu \nu }}\left( g \right) = \ell _P^2\left( {{R_{\mu \nu }} + 2{\nabla _\mu }{\nabla _\nu }\Phi - {H_{\mu \nu \lambda \kappa }}H_\nu ^{\lambda \kappa }} \right)$$

$$ {\beta _{\mu \nu }}\left( F \right) = \frac{{\ell _P^2}}{2}{\nabla ^\lambda }{H_{\lambda \mu \nu }} $$

$$ \beta \left( \Phi \right) = \ell _P^2\left( { - \frac{1}{2}{\nabla _\mu }{\nabla _\nu }\Phi + {\nabla _\mu }\Phi {\nabla ^\mu }\Phi - \frac{1}{{24}}{H_{\mu \nu \lambda }}{H^{\mu \nu \lambda }}} \right) $$

Where $\ell_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_{\mu \nu }} + 2{\nabla _\mu }{\nabla _\nu }\Phi - {H_{\mu \nu \lambda \kappa }}H_\nu ^{\lambda \kappa }} = 0$$

$${\nabla ^\lambda }{H_{\lambda \mu \nu }} = 0$$

$$ { - \frac{1}{2}{\nabla _\mu }{\nabla _\nu }\Phi + {\nabla _\mu }\Phi {\nabla ^\mu }\Phi - \frac{1}{{24}}{H_{\mu \nu \lambda }}{H^{\mu \nu \lambda }}} = 0$$

Look at the first one, because that was killed to ensure conformal invariance for gravity (which explains $\beta_{ \mu\nu }\left(G \right)$). Now, isn't this just the EFE with the stringy corrections from the Dilaton field?! Q.E.D.