Here is a list of many in the Bible whom Islam says were prophets and their behavior concerning the question of adultery (Muslims may pronounce the names differently or ascribe different names to them).
And [remember, O Muhammad], when you said to the one on whom Allah bestowed favor and you bestowed favor, "Keep your wife and fear Allah ," while you concealed within yourself that which Allah is to disclose. And you feared the people, while Allah has more right that you fear Him. So when Zayd had no longer any need for her, We married her to you in order that there not be upon the believers any discomfort concerning the wives of their adopted sons when they no longer have need of them. And ever is the command of Allah accomplished
and if you desire any you have set aside (no sin is chargeable to you)" (xxxiii. 51), I ('A'isha.) said: It seems to me that your Lord hastens to satisfy your desire.