We establish a link between the Schlesinger system and the Ernst equation (the stationary axisymmetric Einstein equation) on the level of algebro-geometric solutions. We calculate all metric coefficients corresponding to general algebro-geometric solutions of the Ernst equation.