Short answer
Islam came to Indonesia peacefully, through Muslim traders from Arabia, India and Persia who sailed the Indian Ocean routes. The first known Muslim kingdom, Samudra Pasai in northern Sumatra, appears by the late thirteenth century CE, and Islam spread across Java and the islands over the next centuries through trade, marriage and teachers.
The accepted historical account is that Islam reached the Malay world without conquest, by merchants, scholars and Sufi preachers, and that local rulers' conversion helped it spread. Most Indonesian Muslims follow the Shafi'i school.
The four schools agree on this.
Explanation
Muslim merchants were sailing to Southeast Asia for spices and trade from early on. Over time some settled in port towns, married local women and built mosques. Rulers of these ports saw the benefits of joining the wider Muslim trading world, and their conversion led many of their people to follow.
The earliest clear Muslim kingdom is Samudra Pasai in northern Sumatra. The gravestone of its first Muslim ruler, Sultan Malik al-Salih, is dated to 696 AH (1297 CE). Ibn Battuta visited Samudra in the 1340s and described a Muslim sultan who loved scholars and debated fiqh with them. In the fifteenth century, Malacca on the Malay peninsula became a major Muslim trading power, and Islam spread along its trade network.
On Java, Islam spread in the fifteenth and sixteenth centuries. Javanese tradition credits the Wali Songo, nine saintly scholars, with teaching Islam through mosques, schools and local culture. Over time, much of the archipelago became Muslim, though the process continued for centuries and some areas remained Hindu, Buddhist or Christian.
Indonesia is now the country with the largest Muslim population in the world, and it reached that point with no Arab army ever landing there. It is one of the clearest answers to Was Islam spread by the sword?
The evidence
Quran, Surah An-Nahl 16:125
ٱدْعُ إِلَىٰ سَبِيلِ رَبِّكَ بِٱلْحِكْمَةِ وَٱلْمَوْعِظَةِ ٱلْحَسَنَةِ ۖ وَجَٰدِلْهُم بِٱلَّتِى هِىَ أَحْسَنُ ۚ إِنَّ رَبَّكَ هُوَ أَعْلَمُ بِمَن ضَلَّ عَن سَبِيلِهِۦ ۖ وَهُوَ أَعْلَمُ بِٱلْمُهْتَدِينَ ﴿١٢٥﴾
Invite to the way of your Lord with wisdom and good instruction, and argue with them in a way that is best. Indeed, your Lord is most knowing of who has strayed from His way, and He is most knowing of who is [rightly] guided.
Calling by wisdom and good example, as the traders and teachers did.
Where the ruling is recorded
- Rihla (Ibn Battuta), Account of his visit to the island of Jawa (Sumatra) and its sultan. An eyewitness account of the Muslim kingdom of Samudra in the 1340s.
- Hikayat Raja-Raja Pasai, Account of the conversion of Merah Silu (Malik al-Salih). The Malay chronicle of the first Muslim ruler of Pasai.
This answer is pending review by the scholars on our team. Quran translation by Sahih International. Hadith Arabic from the standard editions of the six books and the Muwatta, with gradings as recorded there; the English is our own rendering. Spotted a mistake? Tell us.