For reference, see this comparison image of the koppen climate scale and the percentage population of muslims by country. Generally speaking, warmer colors (red, orange, yellow) are hotter and drier.
I have always found it bizarre how the geographic spread of the religion matches almost exactly with the distribution of dry and arid climate zones (excepting Indonesia). What is up with this? The distribution of Islam skips over the mild climate of Ethiopia and goes right onto the arid parts of the Horn of Africa! It extends well into the steppe of Eurasia, but stops where it switches from warm steppe to cold steppe! I know that geographical determinism is not looked upon kindly, but what is the explanation for this correlation?
EDIT: Thanks for all the answers! I kind of knew that 'arid climate' was not really the factor that determined the outcome of Islam's spread, but reading all of your responses to the idea and your explanations of why Islam spread to where it did and not elsewhere provided a ton of amazing information. For me, the most interesting concept brought up was the role that trade played in the spread of the faith. Of course, that idea just brings up even more questions, which is what I love about history/this sub.
I definitely don't want to invalidate your question, because I do think there's something there, and hopefully someone who has in-depth knowledge on early Islamic history can speak to this.
But: I will say a few things that should be taken as caveats. One is that "percentage of Muslim population by country" is not necessarily the best way to determine where the world's Muslims live, and using national borders on a map can give undue emphasis on sparsely-populated countries. For instance, Niger will look like a huge Muslim country, when in fact it has some 15 million people, which is relatively small, all things considered. Indeed, if you look at a map of the world's Muslims weighted for population, you will see that something like half of the world's Muslims live east of the Indus, in relatively wet, fertile regions. Indonesia is less of an exception, as Bangladesh, India and Pakistan have huge Muslim populations, and even a country like China has more Muslims than Syria does (or did before the war). Even in those heavily-Muslim countries in the Middle East, the population (Muslim and non-Muslim) is concentrated in fertile areas.
Second point - the Muslim population data used for this map I suspect comes from a Pew Research survey from 2009 titled "Mapping the Global Muslim Population'. Now, overall Pew is a very reliable source of data, but it's worth noting a few things about this report. One is that their estimates of certain countries' Muslim populations are higher than other estimates, notably in the case of Egypt - Pew thinks their estimate is more accurate, but it's a debated point. Second is that such maps may or may not show a percentage of Muslim citizens in a Middle Eastern country, as opposed to a percentage of Muslim residents in such a country, the latter including non-citizen residents including expatriates. In the case of Saudi Arabia this creates a statistical tautology - Saudi citizens must be Muslims, ergo anyone in Saudi Arabia who isn't a Muslim isn't a citizen. Some estimates have a third of the Saudi population as non-citizen foreign workers, a substantial number of whom are not Muslim (and therefore also cannot openly practice their religion). So take certain percentage estimates with a grain of salt.
To get more specific regarding another point, specifically "[Islam] extends well into the steppe of Eurasia, but stops where it switches from warm steppe to cold steppe!" I think again relying on country percentages and national borders is a bit misleading. Russia, for instance, has a fairly large population of Muslims, and they are concentrated among particular nationalities located within Russian borders, notably Chechnya, Ingushetia, Dagestan, other parts of the North Caucasus, Tatarstan and Bashkortostan. A sub-national map of Russia will show how these Muslim communities are concentrated, and Tatarstan notably is smack on the middle of the Volga River. Even the warm steppe/cold steppe distinction is exaggerated, as Kazakhs traditionally are Muslim and very much live in cold steppe regions - not just in Kazakhstan, but there are sizeable populations in northern Xinjiang and western Mongolia as well. Of course much of those steppe regions were also ideal for agriculture and experienced a long period of conquest and settlement by Europeans under the Russian Empire, and ironically part of that process of Russian conquest involved making sure that steppe nomads like the Kazakhs adhered to officially-sanctioned forms of Islam.
There really isn't any such correlation other than based on geographic proximity to Arabia, where Islam first began. The map you see doesn't quite include Islam's full reach, which in addition to tropical Malaysia and Indonesia also advanced as far as Iberia, southern Italy, the Balkans, and much of what is now southern (European) Russia, especially near Crimea, as well as Bangladesh. None of these regions are nearly as arid as the regions highlighted on the map, especially the Sahara. And while geographically there may seem to be a lot of red, it is worth pointing out that from a population point of view much of these regions are relatively unpopulated. The top 5 nations with the largest population of Muslims, as given by the Pew Center here, are Indonesia, India, Pakistan, Bangladesh, and Nigeria, one of which is mostly arid (Pakistan, but the population lives primarily in a few less arid areas), and they make up nearly 50% of the global Muslim population.
TL;DR: Little to do with Islam as a faith.
Speaking in very general terms, we can speak of a few crucial processes in the geographical expansion of Islam.
Early Arab conquests and subsequent conversions.
The conquests of Muhammad's immediate successors, the first four "rightly guided" caliphs and the subsequent Umayyad dynasty, established Islam in its civilizational core: the Arabian Peninsula, the Levant, Iraq, Iran, North Africa, southern Central Asia, and formerly Andalusia. As it so happens, the initial "opening of lands" (futūh al-buldān, a term early Muslims used for the Arab conquests) did take place in fairly arid climates.
Is this because early Islam or its armies were uniquely suited for the desert? Given the geographic origin of the Arabs, there might be some merit to the idea. The Byzantines, who were in these centuries the Arabs' major enemy, actually pointed out (from Haldon 2016):
Their people is hurt by cold, by winter, and by heavy rain. It is best, therefore, to launch attacks against them at such times rather than in good weather. Their bowstrings become slack when it is wet and because of the cold their whole body will become sluggish. Often while making their incursions and plundering raids at such times, they have become overcome by the Romans and destroyed.
But I'm overall skeptical. Let's look at some of the major regions where the early Arabs were stymied:
The Christian kingdoms of arid Nubia (modern northern Sudan) defeated Arab conquest around 650, instead voluntarily entering into tributary relations with the caliphate.
There was actually no serious attempt by the early Muslims to conquer Ethiopia (only an on-and-off war to halt Ethiopian piracy and take naval control of the Red Sea, which the Arabs had won by the 700s). This is despite the fact that much of the climate in northern Ethiopia (modern Eritrea) is similar to what the Arabs did conquer.
The rump Roman-Byzantine empire survived despite the immense amount of resources that the caliphate poured into the conquest of Constantinople—certainly more resources than probably any campaign in Arab history. But going by climate alone, what remained of Byzantine territory was not very different from many dryish and coldish parts of Iranian Plateau that the Arabs did subjugate. The above quote notwithstanding, the Byzantines survived thanks less to climate and more to the details of the terrain itself, as well as a series of imperial reforms designed to restore vigor to the state.
The Arabs failed to conquer the humid country of the Franks, yes. But it seems unlikely that any conquest would have been possible even had France had the geography of Saudi Arabia, simply because the Arab-Berber conquerors were hard-tasked just with holding Spain. Even before the Franks had shown stout resistance, the conquerors could only afford one garrison (at Narbonne) for the entirety of their holdings and alliances north of the Pyrenees. And any plans for more extended operations against the Franks were derailed by a massive rebellion of Berbers (indigenous North Africans who represented the majority of the conquerors) against Arabs beginning in 740 and the subsequent collapse of the Umayyad caliphate, an event again largely unrelated to climate.
The Arabs never made a real attempt to penetrate the very arid Thar Desert of India either, again likely because it was too far from the imperial center.
Overall, it looks like the geopolitical conditions of both the early caliphate and its neighbors—the caliphate's imperial overstretch and Arab vs. non-Arab divisions that led to the Berber Revolt and ultimate Umayyad disintegration, but also a capable response by Byzantines, Franks, Nubians, and others—are more to credit than climate.
Persianate expansion into Anatolia, the Balkans, and India.
If the early expansion of Islamic civilization was driven by its Arab founders, the Turkic peoples should be credited with much of both its current reach and cultural hues. But the Turkic conquerors of Early Modern Islam were profoundly influenced by the urban civilization of Persia. Hence we call the empires they founded Persianate: not ethnically Persian, but still adhering to Persian cultural standards.
The Persianate empires most responsible for the geographical spread of Islam were the Seljuks in Anatolia and the Ottomans in the Balkans, and a series of Turko-Muslim dynasties in India, culminating in the Mughals.
Now, it's true that Anatolia is fairly dry and the Balkans are comparatively much wetter. In 2020, Anatolia (Turkey) is almost entirely Muslim, while the Balkans are almost all Christian. This might seem to support the idea that Islam really does spread better in arid areas.
But in Ottoman times, the Balkans themselves were nearly 40% Muslim (see McGowan 1981, Economic Life in Ottoman Europe, p. 84), while there was a very significant Christian minority in Anatolia. Today, a map of religions in Turkey and the Balkans matches neatly with a more arid Turkey on one side of the line and the wetter European countries on the other. But this is largely a product of ethnic cleansing and genocides during the bloody disintegration of the Ottomans in the nineteenth and early twentieth centuries.
(You might argue that the fact that a Muslim majority was achieved in Anatolia but not in the Balkans, despite the same effect of Ottoman rule, still shows that Islam spread better in the arid region. But actually, this is simply because Anatolia was ruled by Muslims since the eleventh century and was already overwhelmingly Muslim in the 1500s, while the Balkans fell under Ottoman rule only in the late fourteenth century and was still at least 81% Christian in the 1500s.)
Meanwhile in India, most of the region—both dry and wet—did not convert to Islam. This is probably because the Turkic conquerors never sought to fundamentally disrupt the basic structure of Hindu rural society, which in any case proved remarkably resilient to any such would-be attempts. If anything that would have been counterproductive, since an assault on Hindu society at large would have undermined the famed riches of India that drew the conquerors there.
The two major regions of India that did see popular conversion to Islam under Mughal rule show why this didn't happen in other areas, and it's not climate.
In western Punjab (modern Pakistani Punjab), which is relatively dry, Mughal rule was associated with a large increase in agricultural production in areas that had previously been lightly farmed. So a new type of society was created, with people who had never been previously been farmers (Jats, a caste of mostly herders) and had never really known that much about Hinduism becoming agriculturalists for the first time in their lives. The religion of this new society was Islam, the Mughal state religion.
The same story goes for the eastern Bengal (modern Bangladesh), although it is on the other side of the Subcontinent and among the wettest places on Earth. Mughal rule saw agricultural intensification in places that had previously been forested, which drew local slash-and-burn farmers into a sort of economy and society they had never really lived in before. And what better god to protect them in this new world than the new God of Islam? (For a discussion of Bangladesh's conversion to Islam, see this book, available for free thanks to University of California).
So the key point in India is that existing Hindu societies were resilient to Islam, regardless of climate; new agriculturalist systems that formed under Islamic rule proved extremely fertile ground for the Islamic message.
Indigenous conversion in Sub-Saharan Africa, the Indian Ocean, and the steppe.
Running out of space here, so I'll have to be brief.
In West Africa, the current borderline between Islam and Christianity matches the border between the flat arid Sahel and the wet rainforest coast. Probably the biggest factor is that the indigenous Islamic empires that spread Islam in this region failed to expand south into the rainforest. Horses die in the African rainforest because of the tsetse fly, and the terrain and climate are drastically different. So the border of Islam here matches the borders of local empires, which in turn match the ecological and biological borders.
But Islam might have been on its way to slowly expanding south into the very humid rainforest anyways, had European imperialism not cut its advance short. By the 1800s, the polytheist king of Asante in modern Ghana was entering into regular correspondence with local Muslim leaders in northern Ghana, requesting them to pray for his health as a "benefactor of Muslims." At the same time, Fulani Muslims, motivated by a zeal to restore and expand the faith, were expanding into the forests of Nigeria in force. Who knows what might have happened eventually?
As for the steppe, you say that:
It extends well into the steppe of Eurasia, but stops where it switches from warm steppe to cold steppe!
But historically, Islam was the religion of the elite of the entire Turkic steppe, all the way north to southern Siberia. Kazakhstan is less green on the map you have there because a fourth of its population are Christian Russians (with a small German minority). Ethnic Kazakhs are almost overwhelmingly Muslim, at least in name.
In eastern Africa, the Muslim Swahili Coast is pretty wet. It is true that Muslim Somalia is arid and Christian highland Ethiopia is not, but this is largely because Somalis were never Christian, and hence more willing to accept a new universal faith, while Ethiopia was already Christian before Islam. It might also be worth noting that Ethiopia might be majority Muslim today had a would-be Muslim conqueror had some more luck in the sixteenth century.
Southeast Asia is obviously all wet.
The images are oversimplified and misleading -- within those regions there is a lot of geographic diversity. The most obvious are: Syria, Iraq, and Iran, which are all bright red on that map, indicating that they're arid, were known in antiquity as the Fertile Crescent because they were so productive agriculturally.
Also, it doesn't give much of a sense of where the population in those areas actually lives -- the most densely populated sections within that area are usually the fertile and mountainous areas. There's very few people who actually live in the Sahara, which appears bright green on the map. Egypt, for example, is 94% desert, but nearly all of its population lives in or directly adjacent to the 6% of land that isn't.
The reduction to population percentages also plays a role in the confusing nature of the map. (Wikipedia has a table of countries by their Muslims populations, taken from a 2017 Pew report, which sheds some light on this -- if you sort by 'Muslim population' instead of 'Muslims as a percentage of populations', the results are quite different).
For example: India: Muslims may 'only' account for 15 percent of India's population of 1.35 billion, but that's still almost 200 million people, more Muslims than in any country in the Middle East (even when the region is defined in its broadest possible definitions). Ethiopia is similar: with 105,000,000 people, of whom 'only' 35 million are Muslim, it's a much lighter green, even though that's more Muslims than live in Afghanistan or Saudi Arabia.
Now, to the question of why Islam stayed in the middle latitudes, it's not about the desert, but along the steppeland that borders the desert to the north, which is where the trade routes were (this is how and why Islam first came to Southeast Asia, for example). In the 7th century, most of the major civilizations and world powers in the Eurasia-African landmass were found within that belt or the zones adjacent to it; the other notable ones were so geographically distant or hard to get to (i.e., sub-Saharan Africa) that it wasn't practical to try to reach them with an army.
When the armies first came bursting out of Arabia, they encountered Persia and Byzantium -- Persia was conquered completely, and from there, with the newly allied Persian forces, they went eastward to the places the Persians knew about and had historically been in conflict with: India & Central Asia.
Byzantium retreated to Anatolia (Asia Minor) but remained in control of that territory for several more centuries -- but here, I would caution that the way the map looks now is not the way it looked 150 years ago. Over the course of several wars between the Ottomans and Russia and various Balkan countries in the late 19th and early 20th century, culminating in World War I, the Muslim populations of southeastern Europe were usually compelled to relocate to what is now Turkey--only Albania and Bosnia have retained Muslim populations of any size.
The other direction the Muslim armies went was across the whole of North Africa (where the fertile lands were). Northern Europe wasn't that interesting because there wasn't a lot going on up there at the time. Spain was acquired almost by accident -- the armies hadn't initially planned to hop the straits, but there was a dispute between the claimants to the Visigothic throne and one of them asked for help from the Muslim armies.
tl;dr: the maps give an overly simplistic impression of both geography and population distribution of the world's Muslims. AND at the time Islam originated and had its largest territorial expansion, most of the major world political and economic powers were found along that belt extending from the Mediterranean littoral across the steppes of Asia into India, Southeast Asia, and China, so this was where the new efforts of the new Islamic polity and its religious message were directed.