Laws have been based, historically, on many factors, such as divine rights, prejudice, etc., but Western society, following in the tradition of Aristotlelian, Thomistic and Natural Law philosophy, used the idea of morality and ethics, which attempts to discern the laws of nature, which govern man. Grotius, the father of Natural Law Theory, stated that "there are laws which would be true even if God did not exist", essentially a code of rules which would be true even if not divined by God. So while there is a commandment which condemns murder, human reason could and does objectively and absolutely determine that this was true; that murder is morally wrong. So, the two just happen to coincide.
Some Biblical laws and philosophical reasonings have clashed, such as the possession of slaves, which human reason has determined to be absolutely immoral and not conducive to a moral society.
Today's legal thinking is based on the more recent anti-rational philosophies of positivism and deconstructionism, which for the former argues that essentially what the majority thinks is true, or the latter, anything traditional must be destroyed.