Having dealt with civil and religious authorities, Moses turns his attention in chapters 20-22 to the lives of ordinary people and legislates on warfare, murder, and the family.
Moses understands that unless the law becomes part of daily living it will remain just that a law that could be forgotten and discarded. He begins his teaching by covering areas close to the heart of the ordinary Israelite: domestic animals, clothing, houses, and vineyards -- all things pertaining to income and shelter. He continues by legislating on the proper moral conduct between the sexes and offers laws to regulate sexual conduct.
It must be borne in mind that Moses's focus is not sex -- that's a modern focus by the society of the early twenty-first century which has become sex-obsessed. Moses's focus is the family. He wants it protected and wants people to live happy healthy lives within their families.
Jesus will keep the same focus when he sanctified marriage at Cana of Galilee. The family was back then, and is still now, the bedrock of civilizations.