The Apostle still shows his difficulty in understanding the change in position that the believers in Galatia were adopting in relation to the apostolic Gospel. He begs them to be like him (not wanting circumcision and bondage to the Mosaic Law), because he had become like them (that is, as a Gentile, free from the Law). The Galatians had not done evil to Paul, in moving away from the Gospel, but had harmed themselves (v. 12).
Paul here illustrates, through Hagar and Ishmael, and Sarah and Isaac, the difference between Law and Faith, as means of eternal salvation.
"Did you not hear the Law?" - The book of Genesis was part of the Pentateuch, which was the Law in a general sense. This same book teaches, through prophetic types, the message of salvation by faith.
Hagar, the handmaid of Abraham and mother of his son Ishmael, figuratively represents those who are of the Mosaic Law, given on Mount Sinai - that is, those who continue in Judaism, desiring to justify themselves by works and legalistic ceremonies.
Sarah, Abraham's wife and mother of Isaac, the son of the promise given to Abraham regarding his "seed" (Genesis 21:12, 22:18) represents "Jerusalem which is above"(v. 26) - the current home of all believers (cf. Ephesians 1:3 - Hebrews 12:22), the "heavenly places in Christ Jesus" (Ephesians 2:6), because believers are "children of God through faith in Christ Jesus" (Galatians 3:26).
Nevertheless, Genesis tells how Ishmael (born after the flesh) persecuted Isaac (the son of the Promise) – just as Judaism (the false teachers who wanted to put Christians under the Mosaic Law) persecuted the Apostolic church. See also Galatians 2:3-4.
However, believers in Christ are not under the Mosaic Law and yes, they are free and saved by faith in that Saviour who, by His one sacrifice on the cross, has freed us and made us "children of God.”
12 Brethren, I urge you to become like me, for I became like you. You have not injured me at all.
13 You know that because of physical infirmity I preached the gospel to you at the first.
14 And my trial which was in my flesh you did not despise or reject, but you received me as an angel of God, even as Christ Jesus.
15 What then was the blessing you enjoyed? For I bear you witness that, if possible, you would have plucked out your own eyes and given them to me.
16 Have I therefore become your enemy because I tell you the truth?
17 They zealously court you, but for no good; yes, they want to exclude you, that you may be zealous for them.
18 But it is good to be zealous in a good thing always, and not only when I am present with you.
19 My little children, for whom I labor in birth again until Christ is formed in you,
20 I would like to be present with you now and to change my tone; for I have doubts about you.
21 Tell me, you who desire to be under the law, do you not hear the law?
22 For it is written that Abraham had two sons: the one by a bondwoman, the other by a freewoman.
23 But he who was of the bondwoman was born according to the flesh, and he of the freewoman through promise,
24 which things are symbolic. For these are the two covenants: the one from Mount Sinai which gives birth to bondage, which is Hagar—
25 for this Hagar is Mount Sinai in Arabia, and corresponds to Jerusalem which now is, and is in bondage with her children—
26 but the Jerusalem above is free, which is the mother of us all.
27 For it is written: "REJOICE, O BARREN, YOU WHO DO NOT BEAR! BREAK FORTH AND SHOUT, YOU WHO ARE NOT IN LABOR! FOR THE DESOLATE HAS MANY MORE CHILDREN THAN SHE WHO HAS A HUSBAND."
28 Now we, brethren, as Isaac was, are children of promise.
29 But, as he who was born according to the flesh then persecuted him who was born according to the Spirit, even so it is now.
30 Nevertheless what does the Scripture say? "CAST OUT THE BONDWOMAN AND HER SON, FOR THE SON OF THE BONDWOMAN SHALL NOT BE HEIR WITH THE SON OF THE FREEWOMAN."
31 So then, brethren, we are not children of the bondwoman but of the free.
Galatians chapter 4 verses 12 to 31