According to the Law of Moses, the death penalty was only if a man slept with another man’s wife. Other forms of adultery would have different consequences depending on the situation.
However, it seems clear that Lehi’s group may have been practicing a Law of Moses that differed slightly from the Judahite form. Probably carried down from the northern kingdom refugees.