One of the most helpful tools for understanding scripture is knowing that ancient cultures included a phenomenal amount of information about the meaning of the things they said or wrote in the forms which they used in speaking or writing them and learning as much about those forms as possible. It is as important as knowing the implications of tone of voice, body language, or facial expression for determining what is sarcastic in modern speech.
InclusioMost people think (wrongly) that the the entire stretch of Leviticus 19-20 is one unit defined by a type of literary bookend called "inclusio."
Ancient authors, expecting their primary audience to hear rather than to read the words, used easily understood literary devices to clue every one into what was going on in the literary work. Inclusio is the inclusion on a similar beginning and ending to a section so that hearers would know that that section was about the bookends. Additionally, material at the center of the structure often illuminates the purpose of the section.
A Wrong Turn
In this case, the section opens with 18:1-5, you might think that it closes with 20:22-26 or 27, but you would be wrong. The confusion lies in the structure of the book: either Leviticus was written in a stacked or descending ring structure with a clasp between the first and last chapter of the book and the opposite side of the ring in chapter 19, indicating that it should be read again and again, or it is a set of sets with the introversion in chapter 19 (cf. Milgrom). In either case, chapter 19 is not related to either 18 or 20.
A MatchSo then, the inclusio for chapter 18 matches 24-30 That matches the opening to Leviticus 20:1-9 with 20:2-27.
Since we look between the passages of the inclusio to clarify the meaning of the section, if we miss the fact that 19 is unrelated, then we group the laws in chapter 19 with 18 and 20 and we end up thinking that these are just random laws and either have no thematic cohesion or we apply some theme that does not fit.
Interpreting the Hard Stuff by Understanding the Easy StuffNow, let's examine the content of chapters 18 and 20 to clarify the meaning or reasons for the laws:
The "Easy Stuff"
Chapter 18 continues after the introduction by speaking of specific Egyptian actions with which God takes issue: incestuous relationships (I am going with Milgrom's interpretation of "uncover the nakedness" as a euphemism for sexual contact of any kind). If you know Egyptian history, you know that incest was the natural theological result of having a divine kingship. Because the false god of Egypt (Pharaoh) was considered divine, his family was also considered divine, and to preserve the divine bloodline this family had severe limitations on potential mates, to the point that the daughters of pharaoh were given no choice of mate but to their fathers of brothers. This section further outlaws taking the wives of close relatives while their husbands still live, which is the same as usurping the place of that relative in the hierarchy of Egyptian religion (and had similar connotations for Canaanites).
Chapter 20 begins by talking about Molech and then moves on to the practices of pagan magic. It then proceeds to mirror the section primarily on Egyptian religious sexuality with a section that more closely resembles the sympathetic magic through sexual activity in which the Canaanite tribes (and other surrounding peoples) engaged. We don't have a complete record of these practices, but we know that sex using representatives of the deities was part of the outline (cf. http://claudemariottini.com/2006/11/10/canaan-in-patriarchal-times-part-2).
The Hard StuffNow on to the sections in question: Leviticus 18:19-23 and the parallel passage in 20:10-16.
Here we run into less well known territory. Why is Molech (the idol who demands the lives of children) related to menstrual intercourse? How is that related to bestiality? What do those things have to do with mediums or necromancers? I think the best clue lies in a place where two texts seem to conflict. In this case Leviticus 15:19-24 says:
19 “When a woman has a discharge, and the discharge in her body is blood, she shall be in her menstrual impurity for seven days, and whoever touches her shall be unclean until the evening. 20 And everything on which she lies during her menstrual impurity shall be unclean. Everything also on which she sits shall be unclean. 21 And whoever touches her bed shall wash his clothes and bathe himself in water and be unclean until the evening. 22 And whoever touches anything on which she sits shall wash his clothes and bathe himself in water and be unclean until the evening. 23 Whether it is the bed or anything on which she sits, when he touches it he shall be unclean until the evening. 24 And if any man lies with her and her menstrual impurity comes upon him, he shall be unclean seven days, and every bed on which he lies shall be unclean.
Why would the death penalty apply in one instance and not the other? The answer, I think lies in sympathetic magic. In sympathetic magic, one enacts representative actions on Earth to request divine actions by analogy, so a male and female have intercourse in the names of deities representing the fertility of the earth to beg for a good harvest or animal fertility, or one dresses enemies up like women to take away their maleness on a metaphysical level. In this case a practice I have not yet found in the literature, a man having sex with a menstruating women (a logical outgrowth of magical thinking because blood represents life and sex represents fecundity) is condemned, while private sex simply causes uncleanness because blood causes uncleanness.
What Does it Mean?
Considering all of that (and more that I thought redundant), I think it is reasonable to conclude that chapters 18 and 20 of Leviticus are not about general sexual behavior, but about avoiding the religious superstitions of the Egyptians and the magical thinking of the peoples of Canaan. Though that does not say that any of these types of actions is right, if I am right about the meaning of the prohibition, it does mean that this passage should not be used as a reason to condemn them either.