How do solutions of water, elements, and compounds that can crystallize into a mineral form deep underground?

Yes I do know it is not chemistry...