Customs, beliefs, and worldviews change, and with them so too laws—no mystery here. But when we have a so-called “Book” that in actuality is a collection of the laws and narratives that reflected the customs, beliefs, and worldviews of a people (and peoples!) spanning approximately 1,000 years, contradictions are bound to occur. There should be no mystery here either.
Thus, reflective of archaic customs shared throughout the ancient Near East, the older Yahwist and Elohist traditions have no qualms about informing its audience that Abraham’s wife, Sarah, is in fact his sister. And Genesis 20:12 further specifies that Sarah was his sister on his father’s side. Even though these stories were written down circa the 9th-8th centuries BC, they most likely reflected archaic views and customs. Certainly marrying one’s father’s daughter, or any close relative, would have been established norm, especially for many aristocratic or royal families.
Our point is that this was all to change, of course. The 6th c. BC Priestly writer of Leviticus, for example, seems to reflect this by sternly prohibiting such customs. The laws that the Priestly writer himself wrote or preserved, since they may well have been part of the tradition that he himself inherited, are all prefaced by the formula “And Yahweh spoke to Moses saying. . .”
The nudity of your father’s wife’s daughter, born of your father—she is your sister; you shall not expose her nudity. (18:11)
And a man who will take his sister, his father’s daughter or his mother’s daughter, and see her nudity, and she will see his nudity, it is shameful. And they will be cut off… (20:17)
“Exposing one’s nudity” not only was a euphemism for sex, but in all likelihood marriage as well. These two laws or prohibitions probably come from 2 different sources, and were redacted together in the book of Leviticus. Many of the laws penned by the later Priestly writer were done in an attempt to preserve Israelite identity. If, for example, the Priestly guild was composing its text while in exile in Babylon, then penning laws that banned those very customs followed by Israel’s neighbors, such as the Babylonians, would certainly have gone a long way in forging Israelite identity during this historical crisis.
In sum, it seems safe to conclude that the different attitudes expressed between the earlier traditions preserved in Genesis and the later ones of the book of Leviticus express the changing customs and views of mankind rather than those of a god or Yahweh.