A cornerstone was a stone or brick that was placed in the corner of a structure's foundation.
The cornerstone of every building in the Caldos colony came from various places in Scotland, including the cities of Edinburgh, Glasgow, and Aberdeen. Maturin explained to Jean-Luc Picard in 2370 that it was done by the colony's founders so that the colonists could "feel they had a piece of the real thing here". (TNG: "Sub Rosa")
Metaphorically, a cornerstone referred to anything that provided a defining or stabilizing influence. (ENT: "The Breach", TNG: "Devil's Due", VOY: "Alliances", "Gravity")