At this point in his epistle, it occurs to Paul that it would only be normal for someone to ask the question, "What, then, was the purpose of the Old Covenant?" Thus, verse 19 begins with, "What purpose then does the law serve?" This broad question covers many more specific ones: Why was it needed? Why did God call Israel out of Egypt? Why did God write His Ten Commandments on tables of stone with His own finger? Why did God have Moses write the statutes and judgments in a book? Why did God establish the Levitical priesthood, the Tabernacle/Temple worship, the washings, oblations, and the sacrifices? What was the purpose of all the rules and regulations of the Old Covenant? Such questions would naturally come to the mind of anyone reading Paul's letter since he emphasizes that our salvation through Christ fulfills the promise made to Abraham. What need is there for another covenant?
The answer he gives is a key to understanding much of everything else he says in Galatians: "It was added because of transgressions, till the Seed should come to whom the promise was made." "It was added" means that the Mosaic covenant was in addition to the one God had made with Abraham. But what "transgressions"? Abraham obeyed all of God's laws, commandments, statutes, and ordinances (Genesis 26:5). He taught God's laws to Isaac, who taught them to Jacob. However, after Israel was in Egypt for many years, they forgot them and lived in ignorant transgression of them. Having absorbed so much Egyptian culture in their sojourn, they were even ignorant of the Sabbath day. Paul explains that God "added" the Old Covenant because Israel had gone so far into sin when they lived in Egypt.
Therefore, God had to call Israel out of Egypt and teach them His laws all over again to prepare them for the coming of Christ. He wrote the Ten Commandments on tablets of stone, and Moses wrote the statutes and judgments in a book so that Israel would have a permanent record of His laws and statutes throughout the centuries. God gave them rituals of worship that made them different from other nations, and He forbade them to have anything to do with foreign, pagan customs. Circumcision identified them as a separate and distinct people. These rules and regulations put a hedge around Israel (Isaiah 5:5; Matthew 21:33) to preserve them pure for the coming of Christ.
According to the doings of the land of Egypt, where you dwelt, you shall not do; and according to the doings of the land of Canaan, where I am bringing you, you shall not do; nor shall you walk in their ordinances.
For years, people have wondered how anyone could have transgressed the laws before they were given. Simply put, Paul is talking about the laws of God which have been in full force since creation! When he writes that the Old Covenant was added "till the Seed should come to whom the promise was made," he means that the Old Covenant was temporary; Christ would replace it with the New Covenant. Rather than saying that any of God's laws had become obsolete, he is explaining how important it was to preserve the knowledge of God's laws in Israel to prepare them for the coming of Christ!