Fossil fuels were formed over million years from the remains of ancient biomass, these remains were buried under layers of sand and mud. They were compressed under the ground and sea bed. As the temperature and pressure increased over time, they eventually turned into fossil fuels.