The easiest way to form a crystal is by evaporation of water. There is a limit to the number of atoms that can be contained by a volume of water. As the volume decreases, the atoms are forced closer and closer together finally bonding together to form solid crystals when enough of the water has been removed. The size of the resultant crystal is dependent on the rate of evaporation over time. Slow evaporation yields few large crystals while quick evaporation yields many smaller crystals.
Crystals can also form if the solution or vapor is cooled or subjected to a decrease in pressure.
In general, hot solutions are able to accommodate more atoms per unit of solution. As the solution cools, the atoms have less and less room to move and when the solution has cooled sufficiently, the atoms link together precipitating the mineral. This is the same for changes in pressure. High pressures allow more atoms per unit volume. If the pressure is lowered, the atoms bond together forming the solid mineral.