Sedimentary layers are formed through the accumulation and compaction of mineral and organic particles over time, often in bodies of water, creating a historical record of Earth's past environments and life forms. These layers are crucial for understanding geological history, climate change, and the evolution of life on Earth.