This verse and the one that follows it paints a strange picture of the universe. The Earth and the air around it are depicted as a bubble, with water above being held back by the air itself or a wall of some kind – Ramban described it as being “like a tent” and this syncs pretty well with a lot of other historical interpretations. Modern secular scholarship has attributed this understanding of the universe to the sky, like the ocean, being blue, and leading those below to believe that it, too, contained water.
Many reconcile this bizarre cosmology with some form of the canopy theory. This is not a scientific commentary, but a theological one, and I will not get into that particular back-and-forth here today. Here are some sources for and against it. The basic idea is that, prior to the Flood that Noah has to deal with later in Genesis, the Earth had a canopy of water or ice which surrounded it, and this came crashing down on the Earth to cause the Flood and that was the end of the canopy (and it is why we no longer have one today). I do not believe this explanation holds water Biblically, because the implication in the Flood story is that the holes in the foundations that caused water to come in from above and below were closed, not that the water was expended.
I think a better way to view this verse is the same way I described in my commentary on verse 2 (which you should read before proceeding further). In the Babylonian Creation myth, Marduk (the God of Wind and the King of the gods) defeats Tiamat (goddess of the deep) and creates the waters below and the waters above with her body. Rather than being a statement of scientific or historical truth, I believe the message behind this is both to support God’s creation methods as those of order, and to continue systematically stripping nature of the deities assigned to it, demythologizing things like the ocean and the wind, and making them all blind forces of nature under the command of a single God. Like verse 2, this is one of the clearest declarations of monotheism in scripture, and its message to the people of the era would have been a very strong one rejecting the deification of nature.
Targum Onkelos: And the Lord said, Let there be an expanse in the midst of the waters, and let it distinguish between waters and waters.
Rashi: Let there be an expanse: Let the expanse be strengthened, for, although the heavens were created on the first day, they were still moist, and they solidified on the second [day] from the rebuke of the Holy One, blessed be He, when He said, “Let there be an expanse.” This is what Scripture says (Job 26:11): “The pillars of the heavens trembled” the entire first day, and on the second day: “They were astonished by His rebuke,” like a person who stands in astonishment because of the rebuke of the one who frightens him. [Genesis Rabbah 12:10]
in the midst of the water: In the middle of the water (Targum), for there is a separation between the upper waters and the expanse, as there is between the expanse and the waters that are on the earth. Behold you have learned that they are suspended by the word of the King. — [Gen. Rabbah 4:3]
Rambam: God thoughtfully willed that, in the upper prime matter, an expanse should pass from potentiality into existence, and that it should set the measure for the upper and lower parts of the upper prime matter.
Ibn Ezra: God said effortlessly, “Let the sky be extended, together with the air which results from elemental fire touching the horizon, and let them divide between the waters.”