In multiple ways. First, it is a break off from the Indian sub-continent, not African, even though it is very very close to Africa. Second, the first settlers on Madagascar between 350 and 550 CE were of Malayo-Indonesian descent. Specifically, from Indonesia, Sumatra, and Java. Yes, that is on the other side of the Indian Ocean, rather than across the short Mozambique Channel to Africa. These were joined around the 800s CE by Bantu migrants crossing the Mozambique Channel and intermarrying with the Malagasy.
A big clue about Madagascar’s unusual migration history is that most common language of Madagascar, also called Malagasy, can be identified as part of the Austronesian language family.