The narration of events on the fourth day raises several questions. Does the text state that the sun, moon, and stars were created on the fourth day? If so, how could the universe, "the heavens and the earth," which would have surely included the sun, moon, and stars, have been created "in the beginning" (1:1)? Could the author speak of a "day and night" during the first three days of Creation if the sun had not yet been created? Were there plants and vegetation on the land (created on the third day) before the creation of the sun?
Keil represents a common evangelical viewpoint; he suggested that though "the heavens and the earth" were created "in the beginning" (1:1), it was not until the fourth day that they were "completed." Keil's explanation can be seen already in Calvin, who stated that "the world was not perfected at its very commencement, in the manner in which it is now seen, but that it was created an empty chaos of heaven and earth." According to Calvin, this "empty chaos" was then filled on the fourth day with the sun, moon, and stars. Calvin's view is similar to that of Rashi: "[The sun, moon, and stars] were created on the first day, but on the fourth day [God] commanded that they be placed in the sky."
The Scofield Bible represents another common line of interpretation (the "Restitution Theory" or "Gap Theory"), which can be found much earlier in the history of interpretation: "The sun and moon were created 'in the beginning.' The 'light' of course came from the sun, but the vapor diffused the light. Later the sun appeared in an unclouded sky." According to this view the sun, moon, and stars were all created in 1:1 but could not be seen from the earth until the fourth day.
Both of these approaches seek to avoid the seemingly obvious sense of the text, that is, that the sun, moon, and stars were created on the fourth day. Both views modify the sense of the verb "created" so that it harmonizes with the statement of the first verse: God created the universe in the beginning.
There is, however, another way to look at this text that provides a satisfactory and coherent reading of 1:1 and 1:14-18. First, we must decide on the meaning of the phrase "the heavens and the earth" in 1:1 (see comments above on 1:1). If the phrase means "universe" or "cosmos," as is most probable, then it must be taken with the same sense it has throughout its uses in the Bible (e.g. Joel 3:15-16 [4:15-16]); thus it would include the sun, moon, and stars. So the starting point of an understanding of Genesis 1:14-18 is the view that the whole of the universe, including the sun, moon, and stars, was created "in the beginning" (1:1) and thus not on the fourth day.
Second, we must consider the syntax of verse 14. When one compares it to that of the creation of the "expanse" in verse 6, one can see that the two verses have a quite different sense. The syntax of verse 6 suggests that when God said, "Let there be an expanse," he was creating an expanses where none existed previously (creation out of nothing). Thus there seems little doubt that the author intends to say that God created the expanse on the first day. In verse 14, however, the syntax is different, though the English translations do not always reflect this difference. We should be careful to note that in verse 14 God does not say, "Let there be lights ... to separate...," as if there were no lights before this command and afterward the lights were created. Rather, the Hebrew text reads, "God said, 'Let the lights in the expanse be for separating ....'" In other words, unlike the syntax of verse 6, the syntax in verse 14 assumes that the lights were already in the expanse, and in response to his command they were given a purpose, "to separate the day and night" and "to serve as signs to mark seasons and days and years." If the difference between the syntax of verse 6 (the use of היה alone) and verse 14 (היה with an infinitive) is significant, then it suggests that the author does not understand his account of the fourth day as an account of the creation of the lights but, on the contrary, he assumes that the heavenly lights have already been created "in the beginning."
The Pentateuch as Narrative: A Biblical-Theological Commentary
(Library of Biblical Interpretation)