Coal was formed from the remains of plants that have been buried in the Earth for millions of years. The dead plants were first converted into peat, a highly organic soil, which was then buried. Over millions of years, the peat deposits were subjected to high pressure and temperatures as the Earth's crust buckled and folded. The peat was compressed into lignite, a material with a woody texture, and eventually into coal.
The Carboniferous Period, during which coal was produced, occurred between 286 and 360 million years ago. Geologists (scientist specializing in the study of the origin, history, and structure of the Earth) in the United States sometimes divide this period into the Pennsylvanian (286 to 300 million years ago) and Mississippian (300 to 360 million years ago) periods. Most of the high-grade coal deposits were formed during the Pennsylvanian period.
Sources: Barnes-Svarney, Patricia. The New York Public Library Science Desk Reference, p. 388; New Book of Popular Science, vol. 2, pp. 320-21.