Therefore it is necessary to choose one of the men who have been with us the whole time the Lord Jesus was living among us, beginning from John’s baptism to the time when Jesus was taken up from us. For one of these must become a witness with us of his resurrection.”
So they nominated two men: Joseph called Barsabbas (also known as Justus) and Matthias. Then they prayed, “Lord, you know everyone’s heart. Show us which of these two you have chosen to take over this apostolic ministry, which Judas left to go where he belongs.” Then they cast lots, and the lot fell to Matthias; so he was added to the eleven apostles. (1:21-26)
The man who will fill the vacancy must have been along for the entire ministry of Jesus, from His baptism by John up to and after the resurrection; an eyewitness to everything so that he may join with the other 11 to serve as a witness to what he himself had seen with his own eyes. Two men were found who fit this criterion, and they would let God decide which one of them was to become an apostle.
They prayed that God would show them the man He wanted to fill the post, and they cast lots. While this may seem a poor way to decide things to us today, in the Old Testament it was the correct method to discern the will of God in certain situations (Num. 26:55; 1 Sam. 10:21-21) and it showed their reliance upon the teaching of Proverbs 16:33:
The lot is cast into the lap,
but its every decision is from the LORD.
Thus, those 11 dazed and confused young men became the 12 Apostles who would spread their eyewitness account of Jesus Christ for now, the time was at hand for the Spirit to be poured out into this dark world.