I think this is partly incorrect in the bit about "not spreading Islam". Evidence from early Arabic loanwords into Malgasy implies a early (turn of the millennium or a little later) diffusion of Islam in parts of Madagascar IIRC. It is true, however, that the lack of population would have made the place less attractive to Islamic traders.
However, Madagascar is a big "empty" land. Commercial outposts would highlight the simple fact that "free land available here" so they are likely to develop into a larger scale settlement simply because they have room to do so. Not a guaranteed outcome, but chances are that somebody needing a place to settle will go there (they also need to have an adequate crop package, that is viable but not guaranteed if the first comers are, say, Yemenis).
This is another controversial point.
Historically, it has been assumed that Madagascar has been sparsely populated, but this point would not match with the large-scale impact driven by pre-European population in the whole island.
It has been suspected by several anthropologists that pre-European population in Madagascar was larger than traditionally assumed, and with more diverse ancestry. This led to large-scale transformations on every ecosystem in the island, no matter its remoteness, and the infamous erradication of the native megafauna.
It's possible, but I don't know if it has been somehow proved to this date, even if widely especulated, that Arabs, Persians or early European explorers could have brought some diseases to the island that would cause a serious drop in the population, something in fact easy to figure as most of pre-European Malagasy remained isolated for a long time.
And regarding Islam, I'm sure it was somehaw present when Arabs established some outposts, but it's clear that they did not put much effort in spreading it there, unlike they did in other places (probably they found it unworthy).