Psalm 22 is what theologians refer to as a Messianic Psalm. Though written by David it refers to events that transcend his own life and were fulfilled in the life, and especially the death (crucifixion) of Messiah. This is possible because as 2 Peter 1:21 tells us, "men spoke from God as they were carried along by the Holy Spirit."
When Jesus cried out "My God, My God, why have you forsaken Me" two things were taking place, neither of which was contradictory. Firstly Jesus was feeling the full force of being forsaken by His Father, as sin was placed upon Him and He bore the Father's just wrath for it in our place.
Secondly, just as in our culture, if someone were to say "Amazing Grace how sweet the sound" we know that these words are not being said at random, but we are being reminded of a familiar hymn. The Book of Psalms was the inspired song book of the Jews and for Jesus to quote the first line of Psalm 22 it was a thunderously loud message to all who heard it that He Himself was fulfilling the words of the entire Psalm as he hung there in agony on the cross.
Speaking of the Gentiles, David wrote in verse 16, "For dogs encompass me; a company of evildoers encircles me; they have pierced my hands and feet." There is nothing to suggest any of this happened in the life of David, but were fulfilled around a thousand years later by Christ at the crucifixion. What is more than interesting is that when David penned these words, crucifixion was not even invented as a form of torture and death. Sceptics grope for an answer as to why David could write of such things but the believer's confidence is that only God could have been the source of these words, which is itself a wonderful testimony to the Divine inspiration of Scripture. David was "carried along by the Holy Spirit."
The same can be said about verse 18, when David wrote, "they divide my garments among them, and for my clothing they cast lots." There's nothing to suggest this happened to David, but it did happen to Messiah and Jesus is once again alerting us to that by quoting the opening words of the Psalm. The crucifixion of Christ was not an accidental, haphazard occurence. As the early Church prayed to God in Acts 4, "for truly in this city there were gathered together against your holy servant Jesus, whom you anointed, both Herod and Pontius Pilate, along with the Gentiles and the peoples of Israel, to do whatever your hand and your plan had predestined to take place."
Jesus was never more in the will of God than when He hung on the cross as our sinless sin bearing Substitute. By raising Him from the dead God testified that He was indeed His Son and validified all His claims as to what His death had accomplished. Paul tells us, He "was declared to be the Son of God in power according to the Spirit of holiness by his resurrection from the dead, Jesus Christ our Lord.." (Romans 1:3, 4)
Watch now as Ryan Ferguson delivers a memorized dramatic recitation of Psalm 22 from the ESV Bible. - JS