5 But let us return to what follows in the Gospel narrative. “And Annas sent Him bound unto Caiaphas the high priest.” To him, according to Matthew's account, He was led at the outset, because he was the high priest that year. For both the pontiffs are to be understood as in the habit of acting year by year alternately, that is, as chief priests; and these were at that time Annas and Caiaphas, as recorded by the evangelist Luke, when telling of the time when John, the Lord's forerunner, began to preach the kingdom of heaven and to gather disciples.
For he speaks thus: “Under the high priests Annas and Caiaphas, the word of the Lord came upon John, the son of Zacharias, in the wilderness,” etc. Accordingly these two pontiffs fulfilled their years in turn: and it was the year of Caiaphas when Christ suffered. And so, according to Matthew, when He was apprehended, He was taken to him; but first, according to John, they came with Him to Annas; not because he was his colleague, but his father-in-law. And we must suppose that it was by Caiaphas' wish that it was so done; or that their houses were so situated, that Annas could not properly be overlooked by them as they passed on their way.
Source: Tractates on the Gospel of John (New Advent)