John the Baptist was the last prophet who existed under the Old Testament dispensation. Though he was a Jesus-believer, he was not a Jesus-follower. A new Elijah, his purpose was to rekindle repentance and fidelity of the Chosen People to God in an age when the focus was off of faith and mercy and was on purity laws and obedience.
Here's a brief and general backstory. The Pharisees were a political party and religious movement whose purpose was to educate the masses. They were close to the people, unlike the Sadducees, Levites, and priests who were largely removed from the everyday person, officiating at the Temple in Jerusalem or holding court with the elites. For all their populism, however, the Pharisees believed that the stricter purity laws of the priests who are serving in the Temple should apply to every one of God's people, so in teaching the people, they would focus on these very narrow, very strict interpretations of the Mosaic covenant.
John the Baptist, as a new Elijah, was not of the school of scribes and teachers, but of the prophets. Many scholars today think that John the Baptist was an Essene, a member of a super-strict sect of Pharisees that wholesale rejected the corruption and elitism of the priesthood and Temple system and lived in quasi-monastic communities. They were the ultra-separatists, the ultra-pure. Not only did they reject working on the Sabbath, some refused to get out of bed, and others refused to release their bowel movements! Many did not marry, but remained chaste, going way beyond the stricter priesthood purity laws, focusing on the prescriptions to the Nation of Israel at Mount Sinai when God's glory fell upon Moses and consumed the mountain top.
John the Baptist, as a new Elijah, was not of the Essenes either but was a prophet. A prophet hadn't been seen or heard in centuries, and here was this wild man in the desert denouncing the Pharisees, the Herodians, the whole thing. Condemnations are often a part of the prophetic office simply because God sends the prophet into political and religious messes to clean it up. The role of the prophet is to announce the message of God.
So what was John the Baptist doing in the desert?
John the Baptist was doing what every single Christian evangelist is called to do. It is far less about the denunciations and condemnations and far more about repentance.
See, while the Essenes condemned the Temple systems and the Pharisees despised the privilege of the priesthood, John the Baptist proposed the solution, the only solution, to all of the corruption and institutionalized sin: repentance.
Just as in the first Advent of Jesus Christ's incarnation, so too today in our own life of faith, it starts with preparing the way of the Lord through repentance. Access to the Kingdom of God is not for the elite, the privileged, the rich, or the powerful. Instead, it is through the doorway of humility and contrition, a door that is theoretically open to everyone but practically is shut to the proud, the arrogant, and the self-important.
When you see that pride and conceit are at the core of sin and human brokenness, then the solutions offered by Pharisees and Essenes are wholly inadequate. They are inadequate because they are rooted in the same anti-trinitarian conception of religion as the politically powerful Herodians. The Blessed Trinity, revealed in the incarnation of God the Son, is a communio personarum, a communion of persons based solely upon self-donating love. Pride is self-importance, self-aggrandizement, whereas Christ emptied himself to take the form of a slave. This self-donation to the human race for our salvation lies at the heart of the Trinity. This is what God the Father, God the Son, and God the Holy Spirit do for all eternity because this is what they are from all eternity.
This is why religious elites are hard-hearted people. When faithful dependence on God is replaced by moral achievement, pride in one's own moral adherence to whatever law, code, or purity standards will only end up leading to more self-aggrandizement and more condemnation of those not at your level. Hence, the table fellowship of Pharisees was only with other Pharisees. But if you take the trinitarian self-donating love as your starting point, self-aggrandizement becomes impossible, so your attitude to the moral failures of the world is not rejection or condemnation, but mercy. Mercy is not permission to sin. Mercy still holds evil to be evil. But mercy seeks to find a way to bring a person out from the evil.
Elitism is by its very nature divisive. Elites remove themselves from the masses. The Pharisees managed to do this, even though they were a movement towards the masses, educating them in the Law and the Prophets. I'm not trying to be anachronistic here, but there is a great egalitarianism at the heart of the prophet. In ancient Israel, the prophet denounced and attacked the otherwise untouchable elites who have elevated themselves with money, power, and status. The prophets were proof that no one was above God's laws. They brought all men back beneath the commandments, reminding the king and the chief priests alike that God's eyes fall upon them as well as the commoner working the field.
Prophets are not content with calling out evil, like so many religious commentators (and atheists as well!) in the media seem to be. The prophets call men and women, all men and women, to repent and prepare the way of the Lord. Repentance is the solution, not separation and certainly not more elitism, even if it is a morally stricter elitism!
Jesus Christ revealed to us all what the Way is: the path of humility, of self-emptying love. It is solidarity with sinners to the point of "becoming sin" so that we enemies of God might become the righteousness of God.
I say and write about this often, but if we do not call people to repentance we are not calling them to the Kingdom of God. We are not evangelizers if we are not prophets. John the Baptist prepared people to receive the Kingdom by leading them into humble repentance. We are called to do exactly the same thing.