God condemned men sacrificing their children to false Gods such as Baal and Molek. God did not condemn Abraham offering his son to God and trusting God to take care of his son in the process. The first is abominable to God, the second is faith and is set forth as an example to us by God. The issue is not the physical act, but the motive of the heart.
I don't think we can compare this to adultery. The analogy would break down pretty quickly. Marriage is the picture or the figure of the intimacy that we are to have with God through Christ, and the intimacy that we have as Christ's bride and His body with Him as our groom and head. Sexual purity and the sanctity of marriage is the picture, and a powerful one, of that relationship. Even the act of consummating the marriage that continues in the relationship is such a powerful picture of this spiritual intimacy that we have. People pervert the picture because they do not understand the reality. They do not honor the human relationship, which is the picture of that with Christ, because they do not have, nor do they understand the spiritual intimacy that accompanies real relationship with God through Christ.
So the issue is not that we should not be unfaithful because God condemned it under the law. The issue is that human unfaithfulness demonstrates the fact that we do not understand, nor walk in, sanctification. We do not understand what it means to be in love with our God and what it means to be totally sold out to Him as a result. We do not understand the life of intimacy with God.
In the same way, we cannot think that simply because God condemned men for sacrificing their children to idols, that somehow God broke His own rules in this case.
God never intended for Abraham to kill Isaac in an act of human sacrifice. God intended for Abraham to keep covenant in a way that opened the door, if you will, for God to do the same.
When God created man, He gave man authority to rule and reign in this earth. Man was given a degree of autonomy in that he was given dominion over creation, and was given the power of choice. When man chose to sin, God would have been breaking His own word to intervene to stop it. Remember, since by man came sin, by man came also forgiveness of sin. Abraham's covenant and his willingness to sacrifice Isaac opened the door for God to do the same. It opened the door, through covenant, for God to keep covenant through the incarnation and sacrifice of Christ for our redemption.
God did not ask Abraham to perform a pagan rite of child sacrifice. God asked Abraham, through covenant, to open the door for incarnation. And if we study the scriptures carefully, we find that Abraham knew this before he ever started up the hill with the wood, and the fire. Thank you markuskiwi for reminding me of that scripture.