So your primary question is “Why did John the Baptist go out into the wilderness?”
Well, the Gospels tell you the obvious reason why. He was announcing that he was there to fulfill a Messianic prophecy.
Isaiah 40:1-5 – “Be comforted, be comforted, my people,” says your God. “Speak to the heart of Jerusalem, and call to her, for her evil is come to an end, her iniquity is forgiven. She has received from the hand of the Lord double for all her sins.”
The voice of one crying in the desert: “Prepare the way of the Lord! Make straight in the wilderness the paths of our God!”
Every valley shall be exalted, and every mountain and hill shall be made low, and the crooked shall become straight, and the rough ways plain. And the glory of the Lord shall be revealed, and all flesh together shall see that the mouth of the Lord has spoken.
Now, what normally happened when Jews went out in the wilderness?
Where did Abraham go with his household and his flocks?
Where was the Burning Bush?
Where was Mount Sinai?
Where did Elijah go?
In the later prophets, God promises to meet the bride of His youth (ie, His people) out in the wilderness. This is a Messianic prophecy, one of many, and everybody knew that Daniel’s count of weeks and years was now up. It was time for the Messiah, and you had to go out to the wilderness to meet the requirements of many of the Messianic prophecies.
Exodus 3:18 – “The Lord God of the Hebrews has called us. We will go three days’ journey into the wilderness, to sacrifice to the Lord our God.”
Isaiah 32:15-16 – “Until the spirit be poured upon us from on high. Then the wilderness shall be a fertile field, and a fertile field like a forest. And judgment shall dwell in the wilderness, and justice shall sit in the fertile field.”
Isaiah 51:2-5 – "Look to Abraham your father, and to Sarah that bore you. For I called him alone, and blessed him, and multiplied him. Therefore the Lord will comfort Zion, and will comfort all the ruins of her; and He will make her deserted place like a place of pleasure, and her wilderness like the garden of the Lord. Joy and gladness shall be found there; thanksgiving and the voice of praise.
“Hearken to me, O My people, and give ear to Me, O My tribes. For a law shall go forth from Me, and My judgment shall rest to be a light of the nations. My Just One is near at hand; My Savior is gone forth; and My arms shall judge the people.”
Hosea 2:14-20 – "Therefore, behold! I will allure her, and will lead her into the wilderness, and I will speak to her heart. And… she shall sing there according to the days of her youth, and according to the days of her coming up out of the land of Egypt.
“And it shall be on that day,” says the Lord, "that she shall call Me, “My husband,” and she shall call me no more “My Baal.” And I will take the names of the Baals out of her mouth, and she shall no more remember their names.
"And on that day I will make a covenant with them, with the beasts of the field, and with the fowls of the air, and with the creeping things of the earth. And I will destroy the bow, and the sword, and war out of the land; and I will make them sleep secure.
“And I will espouse you to Me forever. And I will espouse you to Me in justice, and judgment, and in mercy, and in commiserations. And I will espouse you to Me in faith. And you shall know that I AM the Lord.”
What do you do if you are a Jew, and you know you are going to meet the Lord?
What do you do if you are a Jew, and you know you are about to get married?
You wash yourself in running water (literally “living water,” which in Hebrew is “mayim hayim”) from a river or spring. Or you use the manmade replacement for natural outdoor running water, which is a mikveh.
St. John the Baptist was bringing people back to the basics, by reminding them of the Jewish wanderings in the wilderness, and he was proclaiming the future Messiah by fulfilling various prophecies and doing various things as visual signs. (Wearing camelhair and eating locusts and honey, for example, was a sign that he was doing stuff like Elijah.) Ritual bathing was also related to penitence; people did it before Yom Kippur, for instance. Calling people to go to the wilderness and bathe ritually, while repenting and mending one’s ways, was not anything too out of the way. Unusual, but totally within the Law and tradition.
However, John was a true prophet, and he may have known that his baptism (ie, his championing of ritual immersion bathing) was also a sign of what was coming with the Messiah: the bath that would not have to be repeated, the bath in water and the Holy Spirit, the bath that was also rebirth and forgiveness of sins. In any case, God told him to call the people out to the wilderness to be washed and to repent, and he did it. And they listened to him and obeyed God’s call.