Then Jerusalem and all Judea and all the region about the Jordan were going out to him, and they were baptized by him in the river Jordan, confessing their sins. (Matthew 3:5-6)People from all over were coming to John to be baptized. But why baptism? What was its purpose?
The general consensus of Jesus' day was that in order to convert to Judaism, a Gentile had to be circumcised (males only), offer a sacrifice, and be baptized. The inclusion of baptism makes sense because in the Levitical Law, even a converted Jew was required to wash with water to cover impurity— so how much more should a heathen Gentile do the same upon converting?
It's possible that the people John baptized were recognizing the fact that their ancestry didn't earn them salvation. Just like a Gentile convert, they needed to be baptized. They needed to be converted.
John preached that entrance into the kingdom of heaven isn't based on ancestry. So daring was John, that he preached to the Pharisees, saying, "do not presume to say to yourselves, ‘We have Abraham as our father,’ for I tell you, God is able from these stones to raise up children for Abraham" (Matthew 3:9).
John the Baptist attracted people from "Jerusalem and all Judea and all the region about the Jordan". I think it's safe to assume that it wasn't John's dress or diet that attracted his followers (Matthew 3:4). Instead, it was his message and his baptism— a baptism that was not from man, but God (Matthew 21:25).
The four-hundred year silence since the last prophet had been broken. The Messiah's way was being prepared, and people from all over Israel were flocking to John. Though some came for reasons other than repentance, like the Pharisees, there were those who came to humble themselves, who came to be baptized by John in the Jordan and confess their sins.
As Christians, John's baptism should be a reminder to us of our need to always be in repentance, to always humble ourselves before the throne of God. Although we aren't part of John's preparatory work for the Messiah, let us always remember that the Messiah is coming again. Christ could come back at any moment, and, oh, let us be found walking on that day in fruitful repentance!
Edersheim, Alfred. Life and Times of Jesus the Messiah. Appendix XII: The Baptism of Proselytes.
Schurer, Emil. A History of the Jewish People in the Times of Jesus Christ Volume II. Chapter 31: Judaism In The Dispersion.
If you're interested in reading more on this subject, Edersheim's writing is a great place to start. Edersheim also cites plenty of primary sources if you want to explore the subject even farther.