As verse 23 explains, this passage takes an allegorical understanding of the Old Testament stories of Sarah and Hagar in Genesis 16 & 18 & 21. This allegory serves to illustrate the difference between belonging to slavery and belonging to the promise, expounding more calmly what Paul wrote more passionately in the previous passage.
Abraham was promised a son with his wife, Sarah, but in their impatience, he fathered a son, Ishmael, with a servant named Hagar. Ishmael, as a son of slavery, did not receive the promise of God, although God did look after him and bless his family. Ishmael represents the old covenant (shockingly to a Jewish perspective!), and the old Jerusalem, which is not where ultimate salvation is found.
Eventually Sarah bore a son, Isaac, who was part of God’s chosen line. Isaac, a son of the promise, was born in freedom, and represents the new covenant and the heavenly Jerusalem to which all true believers belong.
The Judaizers were acting as descendants of Ishmael instead of Isaac, and trying to pull everyone else with them back into that life of slavery, when in fact we’re called to freedom. As 5:1 says, we must stand firm against such resubmission to slavery.