Adultery does matter whether it is man or woman. From the beginning, God created marriage to be between one man and one woman. That has always been God’s intention, but God knows that people have hardness of heart. So God did not directly condemn men for having multiple wives during Old Testament times, which was what Abimelech did when he took Sarah.
But when Jesus came to earth, this is what happened:
“Some Pharisees came up to Jesus, testing Him, and began to question Him whether it was lawful for a man to divorce a wife. And He answered and said to them, ‘What did Moses command you?’ They said, ‘Moses permitted a man to write a certificate of divorce and send her away.’ But Jesus said to them, ‘Because of your hardness of heart he wrote you this commandment. But from the beginning of creation, God made them male and female. For this reason a man shall leave his father and mother, and the two shall become one flesh; so they are no longer two, but one flesh. What therefore God has joined together, let no man separate.’” (Mark 10:2-9)
Therefore, Jesus reinstituted God’s original intent that a person is to have one spouse by saying: "the two shall become one flesh".
But during the time of Abimelech, who was king of Gerar (Genesis 20:2), many men had multiple wives. Even Abraham took Hagar as his wife besides Sarah (Genesis 16:3-4). After Sarah died, Abraham took another wife and concubines (Genesis 25:1,6).
It was because of their hardness of heart that God did not directly condemn such actions back then.
For Abimelech, he was a foreign king who lived during the time of Abraham. So God did not make such a requirement of him that he should not have multiple wives, because some of God’s own people had multiple wives. Without Jesus and the Holy Spirit, people’s hearts were hard and they did not know how to love very well or control themselves.
But God did require it of Abimelech that he should not sleep with Sarah. The reason is God protects His people from harm, especially His prophets and anointed ones.
The Bible tells us:
“He has remembered His covenant forever,
The word which He commanded to a thousand generations,
The covenant which He made with Abraham…
He permitted no man to oppress them,
And He reproved kings for their sakes:
‘Do not touch My anointed ones,
And do My prophets no harm.’” (Psalm 105: 8-9,14-15)
God called Abraham His prophet when He told King Abimelech: “Therefore I did not let you touch her. Now therefore, restore the man’s wife, for he is a prophet, and he will pray for you and you will live.” (Genesis 20:6-7)
God permitted certain things in ancient times, because without Jesus and the Holy Spirit, people did not know how to love and forgive fully. But when Jesus came, He made laws for the heart, not just laws for outward deeds.
Jesus said do not be angry because it leads to murder (Matthew 5:21-22), do not lust because it is adultery from the heart (Matthew 5:27-30), do not love any human being above loving God because it is idolatry (Matthew 10:37-39).
Such commandments may seem very hard for us today, but by Jesus’ own blood and the power of the Holy Spirit, we can walk in them.
Moreover, Jesus forgave abundantly in such a way that it surprised people who were ready to stone an adulterous woman to death:
“The scribes and the Pharisees brought a woman caught in adultery, and having set her in the center of the court, they said to Him, ‘Teacher, this woman has been caught in adultery, in the very act. Now in the Law Moses commanded us to stone such women; what then do You say?’…
He straightened up, and said to them, ‘He who is without sin among you, let him be the first to throw a stone at her.’ Again He stooped down and wrote on the ground. When they heard it, they began to go out one by one, beginning with the older ones, and He was left alone, and the woman, where she was, in the center of the court. Straightening up, Jesus said to her, ‘Woman, where are they? Did no one condemn you?’ She said, ‘No one, Lord.’ And Jesus said, ‘I do not condemn you, either. Go. From now on sin no more.’” (John 8:3-5,7-11)
Where was the man who was in adultery with her? The scribes and Pharisees did not bring him but they brought the woman only. By law, both should be put to death:
“If there is a man who commits adultery with another man’s wife, one who commits adultery with his friend’s wife, the adulterer and the adulteress shall surely be put to death.” (Leviticus 20:10)
However, Jesus forgave the woman and gave her a new chance to live. He showed what true love and forgiveness mean, and what repentance is. Even though Jesus had the right to judge her, He forgave her instead and told her to not continue in sins.
This event is a picture of what it is like to believe in Jesus. He forgives us of all our sins for which we deserve the death penalty. And He loves and died for us. We on our part trust in Jesus and from now on repent and turn away from sins.