Then the soldiers of the governor took Jesus into the common hall, and gathered unto him the whole band [of soldiers].
Note 1 at Mt 27:27: This instance of Jesus being mocked by the Roman soldiers was the same instance as the one recorded by John in Joh 19:1-3.
Matthew started this verse with the word "then," putting this occurrence of Jesus being mocked by the Roman soldiers after He had been condemned to be crucified. John also began his account of this incident with the word "then" and followed it with further attempts of Pilate to release Jesus. This looks like a discrepancy between the two accounts.
It must be remembered that Luke was the only Gospel writer to state that he was setting forth events in chronological order (see Introduction to Luke). There are many examples of when the other Gospel writers varied the order of events, as it was not their purpose to present events in the proper order. Luke did not record this event of the soldiers mocking Jesus, so we do not have his input as to the proper sequence.
Any differences in the listing of this event would only amount to a matter of minutes. It is also possible that this mockery by the soldiers could have happened simultaneously with some of Pilate's efforts to free Jesus (compare with note 1 at Lu 22:54).