Marissa, they form in different ways, more than can be given here.
They exist. Some change. For example, carbon exists, subjected to great pressure it becomes diamond
Silicon exists, combined with oxygen it becomes SiO2. That substance forms Quartz, agate, cats eye...that mineral in solution forms petrified some wood. It leaks into the wood and replaces the organic material over time.
Be specific and we can maybe give you general parameters under which your mineral forms.