An accumulation of mud begins with the chemical weathering of rocks. This weathering breaks the rocks down into clay minerals and other small particles which often become part of the local soil. A rainstorm might wash tiny particles of soil from the land and into streams, giving the streams a “muddy” appearance. When the stream slows down or enters a standing body of water such as a lake, swamp, or ocean, the mud particles settle to the bottom. If undisturbed and buried, this accumulation of mud might be transformed into a sedimentary rock known as “mudstone.” This is how most shales are formed.
The shale-forming process is not confined to Earth. The Mars rovers have found lots of outcrops on Mars with sedimentary rock units that look just like the shales found on Earth
