There was no commandment for Abraham to understand! The 10 commandments hadn’t yet been given by God to Moses. That would be 500 years in the future! Abraham didn’t know that he wasn’t supposed to commit adultery. He didn’t keep kosher either, because God hadn’t revealed kosher laws yet.
But you’re right, God did not tell Abraham to sleep with Hagar and father a child with her. That is true. But the Old Testament is fairly ambivalent about polygamy, and sometimes views multiple wives as a sign of God’s blessing.
It’s not until the New Testament that we begin to clearly see the idea that polygamy is a sin.
Boy its my day to not think huh

You are correct there was no commandment.
But here is the thing. Do you ever notice when we are pushed to do something we do not want to do there is anger when its wrong.
You can tell the anger in Abraham’s voice when he tell Sarah more or less this is YOUR mess you deal with it.
Abraham never said, nor even looked at the maid that way. At least no according to the word of God.
But God showed us it was wrong, simply by the way the whole thing played out. If God commanded this of Abraham and Sarah and A. obeyed God it would have not turned out so ugly.
But this is a good lesson early in the bible to show us it does not work. And it is not a command of God. or he would have commanded it.
But we know when it did come out, NOT to do it. So if you did not get the HINT fron Abraham the Commandment spelled it out point blank.
People will try to say Jesus didn;t say that, but they have alot so scripture to ignore.
This one for sure Matt 5:28 Jesus says if you even LOOK at a women with lust you have committed adultery. Now I don’t think that anyone would deny that Abram. did both. He not only looked at another women with lust he did indeed commit adultery both physically and emotionally.
In Deut. 5:18 its pretty clear. and Ex. 20:14
Now you said the Abraham did not know that he should not commit adultery. I cannot say I agree with you. Because we do not know Abrahams heart. But myself I believe he did know it was wrong. If not why was it not his Idea. And why did he not want to do it. From the teachings of Sacred Tradition it appears that Abraham did not want to do this.