A fossil would from through mineral replacement by replacing the existing material of the animals bones with minerals, to become petrified. The Minerals will keep the fossil preserved longer.
Have a good day!!
Neither matter or energy is created or destroyed, it is simply reused.