The geoid (roughly, "Earth-like") is the hypothetical, irregular, surface that sea level would assume if the whole Earth were crossed by a network of deep canals allowing the oceans to find their natural and mean level.
Mean sea level is said to be an equipotential gravitational surface, a surface where the force of gravity is everywhere equal and whose normals (or perpendicular directions) everywhere are the directions of gravity. In other words, it is the natural definition of a horizontal surface and vertical directions.
While the geoid can and is approximated by various regular ellipsoids (or spheroids), and geographic positions are defined with reference to ellipsoids, it is often far more useful to define elevations with respect to (irregular) mean sea level – the geoid – than with respect to a (regular) ellipsoid surface. Such elevations are known as orthometric (roughly, "correctly measured") heights. In contrast, elevations with respect to an ellipsoid are know as ellipsoidal heights.