The dismissal of Hagar happened

Genesis 21:8-13
8 The child grew and was weaned, and on the day Isaac was weaned Abraham held a great feast. 9 But Sarah saw that the son whom Hagar the Egyptian had borne to Abraham was mocking, 10 and she said to Abraham, “Get rid of that slave woman and her son, for that woman’s son will never share in the inheritance with my son Isaac.” 11 The matter distressed Abraham greatly because it concerned his son. 12 But God said to him, “Do not be so distressed about the boy and your slave woman. Listen to whatever Sarah tells
Genesis 21:8-13you, because it is through Isaac that your offspring will be reckoned. 13 I will make the son of the slave into a nation also, because he is your offspring.”
When Isaac was weaned, Ishmael scoffed at him. So Sarah told Abraham to dismiss Hagar and Ishmael. Although this upsets Abraham, God encouraged Abraham and promised to supply and bless Ishmael.
At first I thought Sarah was being jealous and unkind. She was the one who gave Hagar to Abraham. And now that she has her own child, she wants to turn the other child out.
I did not understand why God supported Sarah until I read Galatians 4:22-31.
22 For it is written that Abraham had two sons, one by the slave woman and the other by the free woman. 23 His son by the slave woman was born according to the flesh, but his son by the free woman was born as the result of a divine promise. 24 These things are being taken figuratively: The women represent two covenants. One covenant is from Mount Sinai and bears children who are to be slaves: This is Hagar. 25 Now Hagar stands for Mount Sinai in Arabia and corresponds to the present city of
Jerusalem, because she is in slavery with her children. 26 But the Jerusalem that is above is free, and she is our mother. 27 For it is written:“Be glad, barren woman,
you who never bore a child;
shout for joy and cry aloud,
you who were never inlabor ;
because more are the children of the desolate womanthan of her who has a husband.”28 Now you, brothers and sisters, like Isaac, are children of promise. 29 At that time the son born according to the flesh persecuted the son born by the power of the Spirit. It is the same now. 30 But what does Scripture say? “Get rid of the slave woman and her son, for the slave woman’s son will never share in the inheritance with the free woman’s son.”[b] 31 Therefore, brothers and sisters, we are not children of the slave woman, but of the free woman.
Galatians 4:22-31
The Dismissal of Hagar is a Typology
In the Galatians’ passage, Paul established the typology of Sarah and Hagar.
Both women represent 2 different covenants.
Hagar represents the covenant made with God at Mount Sinai, that is the obey-to-be-blessed covenant. While Sarah represents the covenant made with God at Mount Zion where God swear to be the God-who-remembers-no-more.
With the typology in mind, we can then interpret the dismissal of Hagar as a dismissal of the first covenant when the second arrives. God has found another way to bless man. He doesn’t need to rely on man’s obedience to the law.
Has God done away with the Law?
Well, He didn’t just set it aside. He had Jesus fulfilled it for all. If the covenant has been fulfilled, there is no need for man to fulfil it anymore, right?
Okay, this is sounding like allowing people to sin.
It isn’t.
It allows me to have a closer relationship with God without always checking whether I have it all together. I also do not let my failures get between God and me.
How can I live in sin if I have an intimate relationship with God and rely on Him daily?