This allegory between Hagar and Sarah is a little weird, because the law came through Moses who was a descendent of Isaac. But that’s how allegories work; you can’t take them too literally. So then, the slave woman has a son naturally who is born into slavery and the free woman has a son because of God’s promise who grows up free. In the same way, Paul says, Mount Sinai where the law was given and the earthly Jerusalem where the temple was built represent those who are in bondage to sin which the law makes known to them.
Those who are in Christ, however, are represented by Sarah the free woman and the heavenly Jerusalem where God dwells. He cites Isaiah 54:1 to emphasize the better position of the children of the promise over the children of slavery. He continues to draw parallels from the story of Hagar and Sarah by showing how the children in bondage persecute the children of promise, just as Hagar did to Sarah after Ishmael was born. But just as Ishmael did not inherit his father’s wealth, so too will those enslaved to sin not inherit the eternal life given to the the children of promise.
Again, we can’t take the allegory too literally, or we would wonder how the Lord’s blessing of Ishmael after he and his mother were cast out comes into play. It doesn’t, and it shouldn’t, because Paul ends the allegory before this event. Instead, he is making the point that those who believe in Christ and the free grace He has shown to us is in every way better than a slavish devotion to rituals and rules that do not have power to save.
You have skillfully orchestrated history for many purposes, in near and far contexts.