bible source http://nasb.scripturetext.com/genesis/21.htm
skeptic bible source http://www.skepticsannotatedbible.com/gen/21.html
Verse 1: Then the LORD took note of Sarah as He had said, and the LORD did for Sarah as He had promised.
What has god done to get Sarah pregnant? Interesting... right?
Let me ask you a question. What do you think of Sarah as a person?
First she gave her maid to Abram (previous name of Abraham) in order to have a child [Genesis 16]. Then because "when she saw that she had conceived, her mistress was despised in her eyes", Sarah dealt hardly with her. Eventually, god asked Hagar to go back to Abraham.
Now, Sarah herself has a child. She saw the two half brothers "mocking" hence ask Abraham to drive out this maid and her son, the reason being the son of this maid shall not be an heir with my son Isaac.
Let me ask you another question. If you were Abraham, what would you do? Would you drive out Hagar and her son and let them die in the desert?
OK, god may have his plan. S/he commanded Abraham to drive out Hagar and her son and then later saved them, God even make the son a great nation.
As far as morality goes, that's not very kind.