Does anybody knows how this important notion of hydrostatics was discovered?
I have read that it is about someone walking up and down the mountains of Latin America trying to disprove Cartesian geometry. But I can't remember where I have read that.
In 1727 the Parisian Royal Academy of Sciences held a prize contest on the optimal placement of masts in a sailing ship. Bouguer and 20-year old Euler, then a student of Johann Bernoulli, submitted solutions. The optimal placement of the sail is directly related to the heel angle of the ship where the heeling moment and the restoring moment are equal. This prompted the investigations of ship's stability that led to the introduction of the metacenter.
Bouguer subsequently participated in an expedition to the Andes in Peru, today Ecuador, for geodesic measurements near the equator from 1735 to 1744, where he worked on his treatise Traité du Navire on ship hydrostatics, published in 1746 after his return to France. However, according to Nowacki, he likely started working on ship's stability already in 1732, when he tested the 18-gun frigate Gazelle in Le Havre. Euler worked on the same subject in St. Petersburg from 1737 to 1741, and summarized it in Scientia Navalis published after a delay in 1749.
For infinitesimal angles of heel, Bouguer introduced the metacenter as the point of intersection of two infinitesimally neighboring buoyancy directions, that is directions passing through the centers of buoyancy, the centers of gravity of the displaced water (see his diagram below, g is the metacenter). Generally, the metacenter is the center of curvature of the curve traced by the centers of buoyancy as the ship heels continuously. The significance of it is that the ship is stable when the center of its gravity is below the metacenter. Bouguer constructed the metacenter numerically by using the trapezoidal rule.
Euler gave an equivalent formulation in terms of moments, without introducing the metacenter explicitly. But Euler's book was written in Latin, lacked worked out examples, and remained almost unknown to shipbuilders, while Bouguer's treatise became a blueprint for standard texts.
See Historical Roots of the Theory of Hydrostatic Stability of Ships by Nowicki, where the following diagram from Bouguer's Traité is reproduced.