Coal is formed from prehistoric vegetation that accumulated about 300 million years ago when much of the Earth's surface was covered in swamps. As the plants and trees in these swampy areas began to die, their remains sank into the swamp land, which eventually formed a dense material called peat.
Over time, layers of sediment and soil accumulated over the peat. The combination of heat from the Earth's core and pressure of the rock and sediments caused the eventual formation of carbon-rich coal.
Depending on heat and pressure levels under the Earth's strata, carbon and sulphur content, and moisture level, there are four types of coal: lignite, sub-bituminous, bituminous, and anthracite. A useful coal resource is Enviroliteracy.org, which also has a list of links.
The use of coal can be traced back to around A.D. 50 from cinders in Roman ruins in Britain. There is also evidence to suggest that the Greeks used coal as a fuel in the 4th century. However, extensive mining of coal in Britain only started in the 13th century. To find out how coal was mined in the 18th century, try this web page.
For a more modern look at how coal is extracted, try here.
There are significant environmental impacts associated with coal mining and use. It could require the removal of massive amounts of top soil, leading to erosion, loss of habitat and pollution. Coal mining causes acid mine drainage, which causes heavy metals to dissolve and seep into ground and surface water. Coal mine workers also sometimes face serious health problems, including lung disease from prolonged exposure to coal dust in mines.
Environmental impacts associated with using coal as an energy source are particulate emission, ground level ozone, smog and acid rain. Coal and fuel oil combustion emit fly ash particles into the atmosphere, which contribute to air pollution problems.
Upon burning, coal produces a number of gaseous byproducts, including carbon dioxide, nitrogen oxide, sulfur dioxide and methane gas, all of which contribute to global climate change. There is a lot of information to be had about coal, its processing and distribution, and environmental impact here.