The most accurate answer to how Islam spread to Eastern Africa is:
B. through contact between African and Muslim merchants.
Islam was primarily spread to Eastern Africa through trade routes along the coast, where Muslim merchants and traders established connections with local populations. The interactions between these groups facilitated the exchange of ideas, culture, and religion. While other factors may have played a role, such as intermarriages and certain political influences, trade was the dominant mechanism of spread in this region.