John 19:31-36
John 19:31 (KJB)
The Jews therefore, because it was the preparation, that the bodies should not remain upon the cross on the sabbath day, (for that sabbath day was an high day,) besought Pilate that their legs might be broken, and that they might be taken away.
The preparation was the day before the Sabbath. It was a High Sabbath which means the Passover and regular Sabbath fell on the same day. They wanted to make sure the bodies were taken down from the cross so they went to Pilate and asked if the legs of the prisoners could be broken to hasten their death. During crucifixion, the prisoner would use his legs to boost himself up to gain the strength to breath. When the legs were broken, no strength to lift was available and death was quick by suffocation. (Deu 21:22-23 KJV) And if a man have committed a sin worthy of death, and he be to be put to death, and thou hang him on a tree: {23} His body shall not remain all night upon the tree, but thou shalt in any wise bury him that day; (for he that is hanged is accursed of God;) that thy land be not defiled, which the LORD thy God giveth thee for an inheritance.
John 19:32 (KJB)
Then came the soldiers, and brake the legs of the first, and of the other which was crucified with him.
Pilate gave the order that they were to break the legs and hasten their deaths. I am sure Pilate also had in mind to also hasten the end of this ordeal so he would not have to deal with these religious hate mongers anymore. So the soldiers broke the legs of both of the prisoners on the left and right of Jesus and this would have hastened their death.
John 19:33 (KJB)
But when they came to Jesus, and saw that he was dead already, they brake not his legs:
Since Jesus was in control of this entire situation, He had already given up the ghost and commended His spirit to the Father because the penalty for sin had now been paid. (Psa 34:20 KJV) He keepeth all his bones: not one of them is broken.  The soldiers saw He was already dead and there was no reason to break His legs. He was master of the whole situation.
John 19:34 (KJB)
But one of the soldiers with a spear pierced his side, and forthwith came there out blood and water.
The soldiers had to make sure that all the prisoners were dead and so one soldier took his spear and pierced the side of Jesus and out came blood and water. It is believed that he pierced the pericardium which is a sack that surrounds the heart that contains both serum and blood. This piercing would have proven that Jesus was dead when He was taken off the cross and there was no way He revived in the tomb. The blood speaks of the price He paid for our salvation and the water represents the power of His sacrifice to cleanse us.
(1 John 5:6 KJV) This is he that came by water and blood, even Jesus Christ; not by water only, but by water and blood. And it is the Spirit that beareth witness, because the Spirit is truth. (1 John 5:8 KJV) And there are three that bear witness in earth, the Spirit, and the water, and the blood: and these three agree in one. (Eph 5:26 KJV) That he might sanctify and cleanse it with the washing of water by the word,
John 19:35 (KJB)
And he that saw it bare record, and his record is true: and he knoweth that he saith true, that ye might believe.
John was an eyewitness to the accounts and here he is stating that he is bearing record or testimony to all that he saw. Since John was at the cross, he was able to give many details and these details were important to show that Jesus truly died on the cross and was buried. Not long after the death of Jesus, rumors had begun to circulate that He did not really die on the cross but only fainted and that is why the details that John gave were so important to give evidence to reject those lies. These details were given not only to refute the lies but so all the believers will believe that Jesus truly died and that no breach of faith will exist in any believer. If Jesus did not die, then there would be no salvation and that is what John wanted to extinguish that our salvation was fully paid for.
John 19:36 (KJB)
For these things were done, that the scripture should be fulfilled, A bone of him shall not be broken.
(Exo 12:46 KJV) In one house shall it be eaten; thou shalt not carry forth ought of the flesh abroad out of the house; neither shall ye break a bone thereof.
(Num 9:12 KJV) They shall leave none of it unto the morning, nor break any bone of it: according to all the ordinances of the passover they shall keep it.
(Psa 34:20 KJV) He keepeth all his bones: not one of them is broken.
Here is another great parallel concerning the Passover. When the passover lamb was prepared, they were not to break one bone in the lamb. When Jesus, the Lamb of God, died on the cross, not one of His bones were broken thus fulfilling the type of Passover lamb. It was also a fulfillment of the prophecy of Psalm 34:20 that not one of His bones would be broken. Truly Jesus was definitely in control of this entire event.