In real life, we have the technology to grow crystals through several methods such that anything from alexandrite to zirconia, including diamonds and emeralds that are of higher quality than their naturally occurring counterparts, may be made to order. These processes mostly involved heat, pressure, and liquid or powdered compounds that constitute the crystal in question; e.g., we make diamonds from carbon, emeralds from beryllium, and trace amounts of other compounds as befits the specific crystal. But in Pathfinder, spells like polymorph any object have specific limits against creating "material of great intrinsic value, such as copper, silver, gems, silk, gold, platinum, mithral, or adamantine".
An extremely strict reading of such rules would even prevent one from using transmutation-school spells to combine several small gem stones into one larger object, or removing the impurities from existing items, since the output object would be one of "great intrinsic value".
How then do we get the sometimes enormous, and obviously crafted to fit, crystals referenced in various adventure paths and magic items?