As I have discussed in a series of posts on creation in Genesis 1-3 (see: here, here, here, here, here, here, here, and here), the vast majority of biblical scholars now recognize that the ancient Israelites viewed the cosmos as being formed from a primeval chaotic state, and not ex nihilo. This may be best understood, perhaps, by taking a closer look at their worldview of the order and structure of the cosmos. Biblical scholar Bernhard Anderson briefly summarizes their cosmological world-view as follows:
The Bible takes for granted a three-storied structure of the universe: heaven, earth, and underworld (Ex. 20:4). According to this Weltbild, the earth is a flat surface, corrugated by mountains and divided by rivers and lakes. Above the earth, like a huge dome, is spread the firmament that holds back the heavenly ocean and supports the dwelling place of the gods (Genesis 1:8; Ps. 148:4). The earth itself is founded on pillars that are sunk into the subterranean waters (Ps. 24:2; 104:5), in the depths of which is located Sheol, the realm of death. In this view, the habitable world is surrounded by the waters of chaos, which unless held back, would engulf the world, a threat graphically portrayed in the flood story (Genesis 7:11; c.f. 1:6) and in various poems in the Old Testament (e.g., Ps. 46:1-4; 104:5-9). 
(For a picture of this worldview, see HERE.)
This explanation of the ancient Israelite cosmological worldview makes excellent sense of the P account of creation (Gen. 1.1-2.4a), which views creation as one of providing order through separation and the maintaining of boundaries. For instance, Genesis 1.6-8 (NRSV) reads:
And God said, ‘Let there be a dome [raqi’a] in the midst of the waters, and let it separate [b-d-l] the waters from the waters.’ So God made the dome [raqi’a] and separated [b-d-l] the waters that were under the dome [raqi’a] from the waters that were above the dome [raqi’a]. And it was so. God called the dome [raqi’a] Sky [shamayim]. And there was evening and there was morning, the second day.
For P, the purpose of the raqi’a, which is literally an extended solid surface that encircled the earth (translated as “firmament” in the KJV, “expanse” in the NIV, and “dome” in the NRSV), is to separate the heavenly waters above the earth from the subterranean waters below, so as to provide a space in which God can fashion the remainder of his earthly creation, and in order to hold back these waters from destroying the earth thereafter. Within this “bubble” the earth/land (Hebrew ‘erets) sits upon the subterranean waters with pillars supporting it. Within the raqi’a are holes or “windows” (e.g., Mal. 3.10) which God may at times (from above) open and pour down rain from heaven, and through which (from below) the water for rivers and springs flow upwards. Additionally, as noted just above, the waters above and below the earth, if not restrained by God, may surge forth upon creation rendering it as chaotic as it was before God had formed the cosmos by establishing order through separation and forming boundaries. This is dramatically portrayed in P’s corresponding account of the flood in Genesis 7.11-12. It probably is thus more appropriate then to render raqi’a as “dome,” or something similar, such as the NRSV and several other modern scholarly translations have done, rather than as the (rather ambiguous) translation “firmament” as is found in the KJV.
Furthermore, Israel’s cosmological worldview (as outlined above) coincides with the cosmological worldviews of its ancient Near Eastern neighbors. As mentioned, ancient Israelites did not exist in an ideological and social vacuum, and in this case it seems virtually certain that they shared the dominant cosmological worldview of their day. In fact, as most recent scholarly treatments of the origins of the doctrine of creatio ex nihilo have concluded, no ancient Near Eastern societies held such a view until sometime in the late second century. The fact that no other ancient Near Eastern societies contemporaneous with ancient Israel held this view, combined with the fact that there are no clear or unambiguous references to the notion of creatio ex nihilo until post-biblical times, cuts decidedly against its historical plausibility. In any event, that this ancient Israelite cosmological worldview described above can be so easily superimposed on so many different biblical texts, in conjunction with its terrific overall explanatory power of P’s literary depiction of how God created the earth, in addition to the fact that it also aligns so well within its ancient Near Eastern context, strongly encourages us to take Genesis 1.1-2 as describing a primeval chaotic state from which God formed the cosmos ex materia.
This ancient Israelite cosmological worldview assumes a pre-scientific view of the cosmos that was ubiquitous in the ancient Near East among Israel’s neighbors. This worldview helps make sense of why creation is seen in terms of separation and differentiation in the P account, and this cosmological worldview helps make sense of the numerous literary parallels held in common between P and other ancient Near Eastern texts (see here). What value, then, is to be found in such accounts for modern religious traditions that accept the Bible as an authoritative text in some sense, but which are also informed by modern science?
As just one suggestion, I believe value may be found in the fact that this cosmological worldview makes meaningful sense of Israelite understanding(s) of the purpose of the nation of Israel and the organization of its society in relationship to God. Ancient Israelites believed that the creation of the cosmos by means of God’s establishing order and boundaries on the primeval chaos mirrored God’s creation of Israel, which was separated from all other nations by God’s holy covenant, and which was ordered by this covenants’ attending laws. So too God may separate each of us from the darkness of a sinful, alienated life and give meaningful shape and purpose to each of our chaotic lives by creating us anew through his Holy Spirit as we strive after sanctification.
 See Bernhard W. Anderson’s From Creation to New Creation, OTB (Minneapolis, MN: Fortress Press, 1994), 20.