Gen 1:31
31 And God saw every thing that he had made, and, behold, it was very good. And the evening and the morning were the sixth day.
(KJV)
Exod 31:15-17
15 Six days may work be done; but in the seventh is the sabbath of rest, holy to the LORD: whosoever doeth any work in the sabbath day, he shall surely be put to death.
16 Wherefore the children of Israel shall keep the sabbath, to observe the sabbath throughout their generations, for a perpetual covenant.
17 It is a sign between me and the children of Israel for ever: for in six days the LORD made heaven and earth, and on the seventh day he rested, and was refreshed.
(KJV)
Ah, another insertion by the editor. The timeline is:
1. Exodus happened first. The 10 Commandments were given first. So the original is 15-16. The Sabbath is there because God commands it.
2. Genesis 1 is written many hundreds of years later. The authors are looking for a justification for the Sabbath. They make creation take 6 days so that there can be "rest" on the 7th. For them, it wasn't good enough that God commanded the sabbath.
3. The Pentateuch is an edited document put together from 3 or 4 original sources. To complete the circle and make the documents somewhat consistent, the editor (probably in the time of Ezra) inserts the 6 day creation into 2 places about the Sabbath as unnecessary justification for the Sabbath.
Do you suppose God made them work for 6,000 years before they could rest? Don't hardly think so they were none of them ever that old.