The idea that the Bible is a single unified text, intended to be "God's word for all time" or some such rubbish, is an entirely modern idea, invented in the late 19th / early 20th century by fundamentalist nut-jobs (the original Fundamentalists who actually coined the word).
The point is that the Bible was put together by a bunch of different people, and the law codes of Deuteronomy were produced at a time of extreme social conservatism, some time in the late Bronze Age. More liberal authors of the Torah, Nevi'im (e.g. Amos) and Ketuvim would probably have been horrified by what appears in Deuteronomy.
The Qu'ran was originally produced as an oral tradition, handed down by the followers of the Prophet Muhammad, and intended to be interpreted by qadis (judges) and modified by hadiths (sayings of the Prophet). It wasn't written down until well after Muhammad's death.
The Torah (Jewish scriptures) were always subject to constant reinterpretation and discussion by the scholars (which was basically every Jew who could read and comment on them).
This notion that a religious text should be a completely infallible law code for a religion and be taken completely literally is therefore an entirely modern invention.