This process is called 'Compaction'
Compaction is when very fine layers of sediments build upon one another over millions of years. The top layer exerts pressure on the layers below.
Over the course of time, this pressure forces small sediments to stick to together, leading to the development of solid rocks below the earth's surface