Soil layers form due to the long-term processes of weathering, organic matter decomposition, and leaching, which creates distinct horizons over time.