God indeed, recognized the legitimacy of Sarahs marriage to Abraham and the illegitimacy of his relationship to Hagar,when He referred to Issac as his son, his only son.
****
There are two kinds of marriages here one is for all eternity which Abraham and Sarah have, the one that Hagar has is for time only, til death do we part!
It was adultery, pure and simple. It happened, but not as an example for us to follow. Sin mentioned in Scripture is never mentioned for the justification of immoral behavior.