How did the Shafi'I school of Islamic jurisprudence come to be dominant in eastern Africa and the Indonesian archipelago when those areas are so geographically separated?

by Masaryk
Labrydian

Trade. Here is a map showing the oceanic trade routes. The Shafi'i school historically was popular in Baghdad and Cairo, and you can see there are still Shafi'i areas there on that map. Khorasan in Iran was also a Shafi'i center until the switch to Shi'a Islam after the Safavids came to power. The Shafi'i school was advocated by the Ayyubid dynasty, who also worked to increase oceanic trade. Eastern Egypt, Yemen, and in particular Aden were centers of oceanic trade between South and Southeast Asia or Eastern Africa and the Islamic world. Ships traveling from Cairo to India and SE Asia or Eastern Africa and back would frequently stop at Aden. These traders naturally spread Islam as they traded, which would likely have been the official Ayyubid school. Furthermore, these Muslim traders established trade posts like Samudera Pasai in Sumatra. Eventually, local leaders converted to Islam.

For East Africa it's largely the same, with an extra point. Abyssinia (Ethiopia) is noteworthy in Islam because Muhammad encouraged Muslims who were being accosted by the pagan locals in Arabia to seek refuge in Axum, known as the First Hijra. The Christian Kingdom accepted them for a time until they eventually left for Medina. The close proximity and the economic ties, plus a few raids and wars between the two sides of the Red Sea eventually led to Abyssinia's acceptance of Islam.