Millions of years ago of years ago, the earth began as gases spun off from the sun which cooled to form a core. As the earth cooled further, it formed an outer crust on which we now live. From time to time, gases would punch up from the core to or near the surface (like in volcanoes) and cool into rock. This could occur on land or under the water. Rocks could then move for various reasons (like water motion or earth movement) and break up into stones. In various locations this might result in underwater stones in oceans, lakes, and rivers or pile up on coastal land because of waves or regression of water.