Genesis 21:14
ESV - 14 So Abraham rose early in the morning and took bread and a skin of water and gave it to Hagar, putting it on her shoulder, along with the child, and sent her away. And she departed and wandered in the wilderness of Beersheba.
For follow-up discussion and general commentary on the topic. Comments are sorted chronologically.
This is an example of where the righteousness of man vs. The righteousness of God are in conflict. Another example is when God asked Abraham to sacrifice his son Isaac.
If we use human standards to judge, God is cruel and unreasonable. It is beyond human standard of righteousness. Abraham being God's friend is able to obey the righteousness of God, which is beyond his understanding. That is why he is the only person God called His friend (for Moses, God said he is like a friend (but not a friend but a servant)).