1 The Lord said to Moses, 2 “Speak to the Israelites and say to them: ‘I am the Lord your God. 3 You must not do as they do in Egypt, where you used to live, and you must not do as they do in the land of Canaan, where I am bringing you. Do not follow their practices. 4 You must obey My laws and be careful to follow My decrees. I am the Lord your God. 5 Keep My decrees and laws, for the person who obeys them will live by them. I am the Lord.
This chapter, if you have a bible that has chapter headings, has the heading Unlawful Sexual Relations in the NIV and the ESV, Sexual Relations in the NRSV, Sexual Conduct in the CEV and Prohibited Pagan Practices in the CSB. These are representative of those with headings. However, those without Unlawful or Prohibited are not truly correct as all conduct described is either unlawful or prohibited.
Further, being nitpicking, not all conduct described is about sexual behavior as we read in verse 21
Do not give any of your children to be sacrificed to Molek, for you must not profane the name of your God. I am the Lord.
The rest, however, is about unlawful or prohibited sexual behavior. The reasons for the prohibitions are given in the final verses of the chapter. It is here that God takes the time to explain the why behind His prohibitions.
24 “‘Do not defile yourselves in any of these ways, because this is how the nations that I am going to drive out before you became defiled. 25 Even the land was defiled; so I punished it for its sin, and the land vomited out its inhabitants. 26 But you must keep my decrees and my laws. The native-born and the foreigners residing among you must not do any of these detestable things, 27 for all these things were done by the people who lived in the land before you, and the land became defiled. 28 And if you defile the land, it will vomit you out as it vomited out the nations that were before you.
29 “‘Everyone who does any of these detestable things—such persons must be cut off from their people. 30 Keep my requirements and do not follow any of the detestable customs that were practiced before you came and do not defile yourselves with them. I am the Lord your God.’”
Now Israel and us today had/have very clear reasons why God said in our verses of the day Do not follow their practices. You must obey My laws and be careful to follow My decrees. I am the Lord your God. Keep My decrees and laws, for the person who obeys them will live by them. In fact the last verse Keep My decrees and laws, for the person who obeys them will live by them implies a promise or reward. Various commentaries state by living by them or rather living in them (internalizing them) will lead to
a happy and prosperous life, since disobedience will expose the offender to the penalty of death. The spiritual authorities in the time of the second Temple interpreted this clause to mean that he who obeys these laws shall have eternal life. Hence the ancient Chaldee Versions translate it “Shall have life eternal.”
More to the point, as in Barnes’ Notes on the Bible, through obedience true life is gained, a life connecting one with Yahweh. Then Poole’s Commentary says, Yet it is by the covenant of grace this [eternal] life is promised to all that obey God’s commands sincerely, though not perfectly, 1 Timothy 4:8b godliness has value for all things, holding promise for both the present life and the life to come.
While none of the prohibitions may seem onerous to us it helps to remember these were not uncommon practices at the time God gave these prohibitions to Moses for Israel and us.