Throughout his writings, Paul uses the terms "law" and "covenant" interchangeably. One has to use the context to determine whether he is talking about a single statute, a body of laws, a covenant/agreement, or the Pentateuch. Notice how Paul uses the term "law" later in the book of Galatians:
Tell me, ye that desire to be under the law, do ye not hear the law? For it is written, that Abraham had two sons, the one by a bondmaid, the other by a freewoman. But he who was of the bondwoman was born after the flesh; but he of the freewoman was by promise. (Galatians 4:21-23)
The births of Isaac and Ishmael are recorded in Genesis chapters 16 and 21, hundreds of years before the Old Covenant was given. Yet, Paul refers to that portion of scripture as "the law"! Obviously, in this example Paul uses "law" to mean the entire Pentateuch (the first five books of the Bible), not just the commandments.
The end of Galatians 3:19, as well as verse 20, show that the "law" here was not just instruction to a group of people by a superior; the reference to a mediator shows that there was an agreement being discussed rather than a decree or a body of laws. If a king makes a law, there is no need for a process of mediation because the matter it is not open for discussion with the people. A mediator is only necessary when both parties have to agree to something, which clearly indicates a covenant rather than just a decree or law.
The Old Covenant was in addition to the one that God made with Abraham ("it was added"). It was not the first time that God's law had been taught, though; the Bible says specifically that Abraham kept God's commandments (Genesis 26:5). It shows Abraham and Jacob both tithing. It shows Abel and Noah already having an understanding of clean and unclean animals. The Sabbath harkens back to Creation (Genesis 2:1-3), and was given to Israel again after they left Egypt but before the Old Covenant was proposed (Exodus 16). Reading through Genesis and Exodus, it is very clear that there was a codified set of rules—laws—long before they were officially recorded at Mt. Sinai.
The Old Covenant was added because of the sins of the people. It was added, not to provide a means of justification, but to demonstrate to Israel what was right and wrong, because their "moral compass" had been badly damaged through their experiences in Egypt. The children of Israel sojourned in Egypt for centuries, during which time they lost the knowledge of God's way. They forgot His instructions to such a degree that God had to teach them all over again the way of life that was pleasing to Him. They had been so immersed in the pagan Egyptian culture that all of these laws, statutes, judgments, instructions, etc., were completely new to them. God added the Old Covenant to the one He made with Abraham as a sort of "booster shot"—Israel was so off track that God had to realign them with His ways by means of this temporary covenant.
Paul says that the Old Covenant is "becoming obsolete and ... ready to vanish away" (Hebrews 8:13). However, even though the agreement is ready to vanish away, that does not mean God's law has become obsolete. The law and the covenant, in practice, describe two different things. The law is the codified standard of conduct God gave to His people; the covenant was the agreement in which Israel agreed to abide by God's laws. A change to the agreement, though, does not abolish the standard of conduct! The New Testament abounds with examples of God's law still being in effect (Matthew 19:17; 23:23; John 14:15,21; 15:10; Acts 21:24; 24:14; 26:19-20; 28:23; Romans 3:31; 6:1-2,15; 7:12,22,25; 8:7; I Corinthians 7:19; Ephesians 5:5; I Timothy 1:8-11; II Timothy 2:5; Titus 1:16; 2:11-14; Hebrews 8:10; James 1:22-25; 2:8-12; 2:14-26; I John 2:3-6; 3:22-24; 5:2-3; II John 1:6; Revelation 12:17; 14:12; 22:14).
Christ Himself stated clearly that He did not come to destroy the law, but to show how to fulfill it—to keep it in its entirety (Matthew 5:17-20). He then goes on to demonstrate the intent, or spirit, behind some of the laws. James admonishes each to "fulfill the royal law of liberty"—and there is no hint that he means we should individually "do away" with it!
The Old Covenant was "ordained" by angels (Acts 7:53; Hebrews 2:2; Acts 7:38; Psalm 68:17; I Corinthians 10:4). "Ordained," diatageis (Strong's #1299), usually means "to arrange," "to dispose in order," and is commonly used with reference to the marshalling of an army. A similar word, diatagas (Strong's #1296), is used in Acts 7:53, where it is translated "disposition." It properly means the "constituting" or "arranging" of an army; disposing it into ranks and proper divisions. Hence, it has been supposed to mean that the Covenant was given "amidst" the various ranks of angels being present to witness its transmission.
Deuteronomy 33:2 also shows God with His "holy myriads"—literally "ten thousands of holiness." God was attended by a vast army of intelligent beings, witnessing the ratifying of the Old Covenant with Israel and helping with prescribing, ordering, and arranging the covenant.
The covenant was "in the hand" or "under the control" of a Mediator, one who intervenes between two parties, either as an interpreter, intercessor, or reconciler. In the New Testament, in all the places where it occurs, it is applied to Jesus Christ, the great Mediator between God and man (I Timothy 2:5; Hebrews 8:6; 9:15; 12:24).