Only the back-story here provides a glimmer of something positive to say about how it all came about. According to a very helpful article by Craig Keener in The Lectionary Commentary (Eerdmans, 2001), John the Baptist was probably the only figure who had the courage (and the holy pluck) to stand up to Herod Antipas. This is not the Herod who was around when Jesus was born nor is this the Book of Acts Herod who later persecuted the church and killed, among others, James. But what this middle Herod shared in common with those other two was a real nasty streak of immorality, self-aggrandizement, and corruption.
He had been married originally to a Nabataean princess whom he later dumped in favor of marrying his brother's wife, Herodias. You know the old saying, the heart wants what it wants, and Herod's heart wanted Herodias. So even though it made him guilty of multiple sins (adultery and incest among them) and even though it angered the king of the Nabataeans (to whom Herod's first wife fled in humiliation after Herod took up with his sister-in-law Herodias)—and even though this later led to a military conflict with the Nabataeans in which Herod was roundly defeated and embarrassed—nevertheless Herod married Herodias, and no one save John the Baptist had the moral fortitude to point out how wrong it was.
Had John just stuck to baptisms and some harsh pronouncements about the Pharisees and such, he would have been OK. But John landed in prison because he had the temerity to question the morality of Herod the Tetrarch (he never was actually designated a king and when he petitioned Rome for the title, Caesar Gaius Caligula banished Herod and Herodias to Gaul for the rest of their lives). As has too often been the case in history, the powers that be are content to regard religion as a kind of hobby that seems to satisfy certain needs people have. And so long as it stays in the realm of "hobby," religion and the people who practice it are left alone. But when the religious start to stray out of that designated realm, that's when things get ugly fast.