What does John 19:24 mean?
Soldiers participating in crucifixion apparently had the right to take what they wanted from the victims. In Jesus' case, there are five articles of clothing: probably some kind of head cover, sandals, a cloak, and a belt. The undergarment, a tunic, seems to have been the highest quality item. Rather than rip the fabric apart, the four men gamble to see who gets to keep a second souvenir (John 19:23). The commanding officer, being well-paid, probably had no interest in those garments at all (Matthew 27:54).Other gospels note that it was around this time when Jesus expressed forgiveness towards these men who crucified Him (Luke 23:34).
John, also known as one "whom Jesus loved" (John 13:23), has been brave enough to come close to the cross during this time (John 19:26). He would have seen, first-hand, these soldiers shamelessly gambling for a dying man's clothes. John notes how this resembles the words of Psalm 22:18, which depicts an innocent person suffering at the hands of His enemies. Later, as He nears death, Jesus will recite the opening lines of this same Psalm (Matthew 27:46).