What does John 19:23-24 mean?

23 Then the soldiers, when they had crucified Jesus, took his garments, and made four parts, to every soldier a part; and also his coat: now the coat was without seam, woven from the top throughout. 24 They said therefore among themselves, Let us not rend it, but cast lots for it, whose it shall be: that the scripture might be fulfilled, which saith, They parted my raiment among them, and for my vesture they did cast lots. These things therefore the soldiers did. (John 19:23-24 KJV)

William Burkitt’s Commentary

Here we have recorded our Saviour’s sufferings from the soldiers; they stript him of his garments, before they fastened him to his cross, and divided those garments which could be parted amongst them, and cast lots on his woven coat which could not be divided. Little did these vile soldiers think that they were now fulfilling a scripture prophecy; yet so it was, this action of theirs being foretold, Psalms 22:18 They part my garments, among them, and cast lots upon my vesture. Not that the prophecy made them do it, but was fulfilled by their doing of it. From hence we may gather, that Christ suffered naked upon the cross, as naked, some say, as he came into the world. We had made ourselves naked to our shame, and Christ bacame naked to cover our shame. If, sensible of our own nakedness and shame, we flee unto him by faith, we shall be clothed with robes of righteousness, and garments of everlasting praise.