The geometry is common for certain main group compounds that have a stereochemically-active lone pair, as described by VSEPR theory.
Certain compounds crystallize in both the trigonal bipyramidal and the square pyramidal structures, notably [Ni(CN)5]3−.
[1] As a trigonal bipyramidal molecule undergoes Berry pseudorotation, it proceeds via an intermediary stage with the square pyramidal geometry.
Thus even though the geometry is rarely seen as the ground state, it is accessed by a low energy distortion from a trigonal bipyramid.
Some molecular compounds that adopt square pyramidal geometry are XeOF4,[2] and various halogen pentafluorides (XF5, where X = Cl, Br, I).