The first Pasuk of Sefer Bamidbar reads “Vaydabeir Hashem El Moshe BeMidbar Sinai,” “And Hashem spoke to Moshe in the wilderness of Sinai…” The words “in the wilderness of Sinai” indicate that Hashem intentionally chose to deliver His Torah to us in a desert. Why did Hashem choose to give us the Torah in a desert as opposed to an inhabited land, such as Eretz Yisrael?
The Mechilta in Parshat Beshalach answers that if the Torah would have been given in Eretz Yisrael, the inhabitants of the land would claim that they have a special relationship to the Torah. Since Hashem spoke to us in a desert, a place to which everyone enjoys free and equal access, every Jew has an equal connection to the Torah and its commandments.
Another answer is that when Hashem was looking for a proper place to give His Torah to Bnei Yisrael, He contemplated the Red Sea. However, as it says in Tehillim (114:3) “HaYam Raah VaYanos,” “The sea saw, and fled.” The sea could not face the Shechina, the divine presence, because the idol Baal Tzefon that the Mitztrim worshiped stood at its edge. Hashem also considered the mountains as a site for the giving of the Torah, but, as it says in Tehillim (114:4) “HeHarim Rakedu KeEilim,” “The mountains skipped away like rams.” The mountains were not a legitimate site because Avodah Zarah had been placed on their summits. Only the wilderness was a worthy site. It could receive Hashem without fear or shame, because it was unblemished by any stain of Avodah Zarah. The Midbar was therefore chosen for the site of Matan Torah.
A third answer is that Matan Torah took place in the wilderness is to teach us that we have to become like a wilderness. Civilization, with its material comforts and luxuries, is the opposite of a desert. While it is important to live in comfort, a Jew must be prepared to sacrifice some of these material luxuries for the Torah.