Many factors have been responsible for the spread of Islam throughout the archipelago, which for my answer will also include parts of modern day Malaysia and maybe the Philippines, but treat West Papua as a bit of a special case.
it’s believed that up to about 900 A.D. most of the Indonesian archipelago islands practised some variant of Buddhism, Hinduism, or local religions. Islam began its spread around about 900 A.D., when Muslim traders arrived on the western most island of Sumatra. It’s believed that these first Muslims were mostly Arab traders from the Middle East who set up trading posts in Sumatra. Presumably they married local women, raised their families in Islamic custom, and more and more locals would have converted to Islam due to the opportunities that would’ve opened up by trading (or even travelling) to the Middle East. Few records exist of this process but the excitement of being part of a new, literate, “world religion”, and the commercial opportunities tied to that, can be imagined.
This was a pattern that would have continued on for the next few hundred years. While inland, Buddhist and Hindu monarchs exercised a lot of control, in the coastal villages people would have converted to Islam for a number of reasons, many doing so for the commercial benefits that were opening up through trade. Most of the Hindu / Buddhist / Other principalities and noble courts would have been exposed to Islam, and there were a few converts.
it was a largely, but not completely non-violent process. We can take the (Buddhist) Majapahit of central Java as an example; they overexpanded, crashed through bankruptcy due to crop failures, and were supplanted by new Islamic powers (to cut a very long story very short). Islamic rulers were knowledgable of local custom and belief, and often used highly localised methods of introducing Islam. For example, the local practice of puppetry as entertainment was used as a method of introducing Islam to the community. While apocryphal, an enduring notion of wealthy Muslim art patrons converting the wayang puppet masters (who incorporated plots where the puppet characters of legend embrace Islam) leading to the conversion of millions is strong and probably quite truthful.
The process was not completely bloodless, though. One Hindu kingdom from Java fought a rearguard battle against an Islamic insurgency, making their way to the island of Bali. Incidentally, this is why Bali is majority Hindu.
As we move on to the colonial era, we can also see how the actions of the Dutch, British and Portugese (mostly the first) policy also contributed to the broad spread of Islam. For a variety of reasons, the only thing close to effective control that the Dutch could sustain in Indonesia was a practice of indirect rule. This meant that for any control or profit to be extracted from the region at all, the Dutch had to be prepared to make deals with local leaders. Speaking broadly and in rather gross general terms, the Dutch would favour making deals with inland Buddhist/Hindu regents where possible, or the most inward-looking or corruptible of local rulers, and generally disfavoured coastal, Islamic suzerains if they could - particularly if they were travelled or well connected, most particularly if they were defiant.
By the 19th century, this led to growing resentment against both the Dutch and the ‘puppet’ accomplices, as a growing sense of nationalism became tied to Islam and spread amongst young, anticolonial thinkers. Islamic values of a non-racialised religious community would have been appealing to the anti-colonial generation. The collapse of the Dutch and their colonial intermediaries after World War II created a mood of Islamic inspired nationalism throughout the country, which accelerated the spread of Islam.
in the era of Indonesian independence, government policy was also responsible for spreading Islam even farther. The highly populous islands of (Muslim majority) Java and Madura were the source of ‘trans-migration’ - A government policy to “develop” (sic) areas of Kalimantan, West Papua and many other (“underpopulated” and Muslim minority) islands by moving the population and allocating lands at the fringes of Indonesia to Javanese / Madurese (Almost all of whom are Muslims). This pressure has also been responsible for the spread of Islam even further, as the (mostly male) transmigrants married locally.
Finally, as a way of bringing us into modern times, Saudi education, money and attitudes has lead to something of an Islamic resurgence, which has had an impact on certain evangelical initiatives.
Source:
Vickers, A., 2013. A History Of Modern Indonesia. Cambridge: Cambridge University Press.