Water on Earth came from outer space, from ice in comets and meteors.
When those comets enter our atmosphere the heat generated on entry vaporizes this ice into the atmosphere.
Comets, trans-Neptunian objects, or water-rich meteoroids (protoplanets) from the outer reaches of the asteroid belt colliding with Earth may have brought water to the world’s oceans. Asteroids may have been primarily responsible based on several studies, including measurements of the ratio of the hydrogen isotopes deuterium and protium, since similar percentage impurities as in carbon-rich chondrites were found in oceanic water, whereas previous measurement of the isotopes’ concentrations in comets and trans-Neptunian objects correspond only slightly to water on Earth. In January 2018, researchers reported that two 4.5 billion-year-old meteorites found on Earth contained liquid water alongside a wide diversity of deuterium-poor organic matter.
Wikipedia, Origin of water on Earth, 2019
The Christian Bible says that God created water directly on Earth, however the Quran didn’t do this mistake instead it says that God sent down water from outer space and then made Earth its dwelling:
[Quran 23.18] And We sent down water from the heaven in proper quantity, and we made Earth its dwelling, and We are Able to take it away.
If God made Earth its dwelling (فَأَسْكَنَّاهُ فِي الْأَرْضِ ) then this means that water formed in outer space. In another verse the Quran explains how water came down from outer space.
[Quran 2.164] … In the water which Allah sent down from the Heavens and brought with it life to Earth after being dead and gave life in it to every kind of land animal; And in directing the winds; And in the clouds that are enslaved between the Heavens and the Earth; [All these] are Signs for a people who comprehend.
So the water itself came from the heavens above the clouds. Here God is not talking about rain (matar or wadk in Arabic) instead God is talking about water (مَاءٍ).
In another verse, the Quran says that water originally came from the heavens above the clouds in the form of ice. There are mountains in the heaven that have ice inside them; those mountains could fall on Earth making a very bright flash:
[Quran 24.43] Can’t you see that Allah makes the clouds move gently, then joins them together, then makes them into a pile? Then you see rain come out from within? And He sends down from heaven mountains with ice inside them; that strike whomever He wishes or miss whoever He wishes; Its flash almost blinds you.
God sent down from the heavens (above the clouds) mountains with ice inside them!!! The clouds are enslaved between the Heavens and the Earth but the water itself originally came from the Heavens (above the clouds) in the form of ice in mountains. They make a bright flash; but this is the same description of comets and meteors when they hit our atmosphere.
How could an illiterate man who lived 1400 years ago have known that water originally came from ice in comets?
More than half your body weight is water. Animals and plants on Earth are mostly water. All life in our universe also needs water. When scientists search for life on exoplanets they only look for planets with water; No water no life. However Moslems knew about this 1400 years before it was discovered.
[Quran 21.30] Do not those who disbelieve see that the heavens and the Earth were meshed together then We ripped them apart? And then We made of water everything living? Would they still not believe?
In the Quran all life, on Earth and in the heavens, depends on water.