The context of the verse is here:
The Death of Jesus
45 Now from the sixth hour (noon) there was darkness over all the land until the ninth hour. (3:00pm) 46 And about the ninth hour Jesus cried out with a loud voice, saying, “Eli, Eli, lema sabachthani?” that is, “My God, my God, why have you forsaken me?” 47 And some of the bystanders, hearing it, said, “This man is calling Elijah.” 48 And one of them at once ran and took a sponge, filled it with sour wine, and put it on a reed and gave it to him to drink. 49 But the others said, “Wait, let us see whether Elijah will come to save him.” 50 And Jesus cried out again with a loud voice and yielded up his spirit. (Matthew 27:46)
A quotation from Psalm 22
Although some of those standing under the cross did not recognise it, evidently Matthew and every reader familiar with the Old Testament would immediately recognise those words as the first words of Psalm 22, sometimes called the ‘Crucifixion Psalm’ because of the several verses foreshadowing the circumstances of the Messiah’s death. One of them is these words, another equally famous reference is Psalm 22:18 which directly predicts Matthew 27:32, the casting of lots (or dice) for Jesus’ clothes.
Did Jesus really feel abandoned?
The question which many readers have raised is how could the son of God possibly have felt that God had abandoned him?
It is of course difficult to understand if someone has a mistaken picture of Jesus – imagining Jesus to be God himself (the Trinity), or having existed before himself in heaven as powerful heavenly prince (Arianism). But if someone accepts the simply view of Christ presented in the Bible, there is no problem. According to the New Testament Christ is the son of Mary (therefore “son of Man”, from Adam, which is the Hebrew word for ‘man’), and also ‘son of God’ by the virgin birth. Neither being son of Man or son of God changes that Jesus was mortal – he could die, he could be tempted, he could even doubt. We see this very clearly in the Garden of Gethsemane in the hours before he was arrested. Jesus prayed three times (says Matthew) that God “take this cup away”, yet each time resolved it with “not my will, but yours, be done”. (see Matthew 26:36-45)
The account in Luke adds two extra important details. The first is in Luke 22:43 “And there appeared to him an angel from heaven, strengthening him”. The next extra detail is that even with the angel strengthening Jesus “and being in agony he prayed more earnestly; and his sweat became like great drops of blood falling down to the ground. (verse 44)
Jesus Prays on the Mount of Olives
39 And he came out and went, as was his custom, to the Mount of Olives, and the disciples followed him. 40 And when he came to the place, he said to them, “Pray that you may not enter into temptation.” 41 And he withdrew from them about a stone’s throw, and knelt down and prayed, 42 saying, “Father, if you are willing, remove this cup from me. Nevertheless, not my will, but yours, be done.” 43 And there appeared to him an angel from heaven, strengthening him. 44 And being in agony he prayed more earnestly; and his sweat became like great drops of blood falling down to the ground. 45 And when he rose from prayer, he came to the disciples and found them sleeping for sorrow, 46 and he said to them, “Why are you sleeping? Rise and pray that you may not enter into temptation.”
This passage shows the reason why Jesus had cried to God – he was feeling the God might have abandoned him.