What does Matthew 4:12 mean?

Matthew 4:12 KJV
Now when Jesus had heard that John was cast into prison, he departed into Galilee;

Matthew 4:12 NKJV
Now when Jesus heard that John had been put in prison, He departed to Galilee.

Matthew 4:12 MKJV
But when Jesus heard that John was thrown into prison, He withdrew into Galilee.

Matthew 4:12 KJV 2000
Now when Jesus had heard that John was cast into prison, he departed into Galilee;

Interlinear KJV

Now /de/ when Jesus /Iesous/ had heard /akouo/ that /hoti/ John /Ioannes/ was cast into prison, /paradidomi/ he departed /anachoreo/ into /eis/ Galilee; /Galilaia/

Albert Barnes’ Commentary

Verse 12. John was cast into prison. For an account of the imprisonment of John, see Mt 14:1-12.

He departed into Galilee. See Mt 2:22. The reasons why Jesus went then into Galilee were, probably, not that he might avoid danger— for he went directly into the dominions of Herod, and Jesus had nothing in particular to fear from Herod, as he had given him no cause of offence —but,

(1,) because the attention of the people had been much excited by John’s preaching, and it was more favourable for his own ministry.

(2.) It seemed desirable to have some one to second John in the work of reformation.

(3.) It was less dangerous for him to commence his labours there than near Jerusalem. Judea was under the dominion of the scribes, and Pharisees, and priests. They would naturally look with envy on anyone who set up for a public teacher, and who should attract much attention there. It was important, therefore, that the work of Jesus should begin in Galilee, and become somewhat established and known before he went to Jerusalem.

{1} “Cast into prison” or, “delivered up”