2444 After dealing with the crucifixion and the events that accompanied it, the Evangelist now describes the death of Christ, which we should reverence. First, he shows that it was at the appropriate time; secondly its manner, he bowed his head; and thirdly, the piercing of the dead body (v 31).
He shows that the time was fitting because all was now finished, accomplished. First, he mentions that Christ knew that all things had been accomplished; secondly, we see Christ doing what remained to be done (v 30).
2445 In regard to the first he says, After this, after the things that had just been... mentioned, Jesus, knowing that all was now finished, that is, all that the law and the prophets had foretold about him had now been accomplished: "Everything written about me in the law of Moses and the prophets and the psalms must be fulfilled" (Lk 24:44); "I have seen the end of every consummation" [Ps 119:96].
2446 But because another thing foretold in scripture had to be done, the Evangelist adds that Jesus said (to fulfill the scripture), I thirst. First, we see the words spoken by Christ; then, how his desire could be satisfied; and finally, he is given the vinegar.
2447 The Evangelist says that Jesus said this to fulfill the scripture. This indicates the sequence of events, and does not state the cause why Jesus spoke, for he did not speak in order to fulfill the scripture of the Old Testament. Rather, things were written in the Old Testament because they would be fulfilled by Christ. If we say that Christ acted because the scriptures foretold it, it would follow that the New Testament existed for the sake of the Old Testament and for its fulfillment, although the opposite is true. Therefore, it was because these things would be accomplished by Christ that they were predicted.
By saying, I thirst, he showed that his death was real, and not just imaginary. It also indicated his intense desire for the salvation of the human race: "God our Savior, who desires all men to be saved" (1 Tim 2:4); "For the Son of man came to seek and to save the lost" (Lk 19:10). Indeed, we express our intense desires in terms of thirst: "My soul thirsts for God" (Ps 42:3).
Source: Commentary on John