Coal is used for heating and electricity generation. Understanding how it was originally created is a walk back into history that can be fun, interesting and enlightening. The logical place to start would be to know a bit about the conditions that started it.
Swampy Earth
During the carboniferous time period, roughly 290 to 350 million years ago, much of the earth was covered with shallow seas. The air temperatures were also warmer than they are today, so conditions were ideal for an explosion of plant growth. Indeed, there was a profusion of plant life on what could be considered a swampy earth. This included tree-like ferns that were enormously common.
Lack of oxygenation
As branches, leaves and other plant matter died and fell, it was mostly into shallow waters. The quantities of vegetable matter that fell in the water and sediments brought by water flow prevented the normal breakdown that would have likely happened from occurring. The same thing happens in some swampy areas in the world today. The thick marshy material doesn’t allow natural aerobic decomposition to take place. The result is a spongy mass that can be walked upon, but which has a huge water content.
Sediment overlay
Over the fallen plants, sediments build up. Some of these are from the plants that do have a chance to decompose and part of it is brought in through water flow and flood, as well as the rise and fall of ocean levels, which break down rocks and carry them to lower areas in the form of silt and sand. The silt and other sediments block oxygen from getting to the vegetation in an even more efficient manner than the water and thin layers originally of sediment did. Year after year, more material is laid down on top of the old, trapping the vegetation between rock and a silt/sand mixture.
Pressure and heat
Eventually, the layers of soil build up until there is sufficient pressure to turn the lower layers into sedimentary rock. If the pressure and heat in this process is great enough, the sedimentary rock can turn into metamorphic rock. Beneath all of this, the plant matter that was originally laid down millions of years earlier has also been undergoing the pressure and heat treatment. A dozens of feet of boggy plant material has been crushed and turned into a couple feet of coal, in a seam between rock layers. The greater the pressure and heat, the harder the coal will usually be.
These are the veins of coal that are commonly worked today in many locations around the globe. Movements in the rock can cause the veins to become twisted or tilted. The seams can even become vertical.
The future
This process is continuing; however, the amount of vegetation, conditions, pressure and time needed means that it is unlikely the developing coal will be usable before a few million years or so pass. Natural coal takes a very long time to form.
Coal production takes a very long time, it requires the right materials and it needs conditions that will allow the plant material to become compressed before it has a chance to decay. As long as the conditions are right, it is likely that coal will continue to form for eons, though perhaps not as readily or in as great a quantity as during the carboniferous period.