Dense forests got buried under the soil due to natural processes, millions of years ago. As more soil got deposited over them and they got compressed more. This led them to get exposed to very high temperature and pressure. They slowly got converted into coal under these extreme conditions. The process of formation of coal from dead forests is known as carbonization.