This was basically a factor of trade. SE Asia has in many ways historically been very much involved in trade with India and the West, which is why it's culturally in may ways part of the same larger Indian continuum. This is currently more obvious in mainland SE Asia what with it's dominant Theravada Buddhism with Hindu-derived folk practices. However, maritime SE Asia (the Malay world) was more focused on the Indian Ocean maritime trade and thus tended to follow the patterns of the dominant maritime powers. I'm quoting from The Middle East and Muslim Southeast Asia. It offers a very brief review of the history of Islam in SE Asia but the bibliography points to more detailed sources.
Islam came to Southeast Asia in the 12th century, thanks to Muslim traders and preachers from Gujarat in India and China, who navigated the waters of the Indian Ocean, the Straits of Malacca, the Gulf of Siam, and the South China Sea. The 13th century saw the establishment of the first Islamic kingdom, in Pasai in Sumatra. The Islam developed by Sufi mystics lays stress on Islam's humanistic orientation, with emphasis on love and compassion.3 It was a meeting between the monotheistic, pantheistic tradition of Islamic mysticism and Hindu-Buddhist monism, in the form of worshiping Siva and Buddha, which resulted in the emergence of syncretic Islam, a combination of the teachings of Islam mixed with Hindu, Buddhist and animist beliefs and ritual practices.
In a top-down arrangement, Javanese elites saw themselves as Muslims, Hindus and Buddhists all at the same time. During the 15th and 16th centuries, Islam spread through the works of the nine Muslim saints of Indonesia, known as Walisongo, who were of Indian and Chinese origins, and also through other mystics such as Hamza Fansuri (d. 1590), and Shams al-Din of Pasai (d. 1630). Others, such as al-Raniri (d. 1658) from Randher, Gujarat, India, engaged in the propagation of orthodox Islam.
Thus, you essentially see a syncretic culture developing across the Malay world, as a rule of thumb, more orthodox in the Western areas of the Archipelago, such as Peninsular Malaya and Sumatra, and more syncretic in places like Java.
Even when European powers began to dominate the trade routes, much of the day to day trading was done by Muslim traders, often with roots in Yemen and Gujurat.