And whosoever lieth carnally with a woman, that is a bondmaid, betrothed to an husband, and not at all redeemed, nor freedom given her; she shall be scourged; they shall not be put to death, because she was not free.
#Leviticus 19:20 KJV

The KJV mistranslates a phrase in this verse. It sounds as if the woman is automatically to be punished, but the Hebrew doesn't say to scourge her. It says to "make a distinction". In other words, there needs to be a thorough investigation. There's a complicated relationship between master, slave, and betrothed.

Here's the ESV of the same verse:

If a man lies sexually with a woman who is a slave, assigned to another man and not yet ransomed or given her freedom, a distinction shall be made. They shall not be put to death, because she was not free...