Vast majority of muslims of India, Pakistan and Bangladesh are low caste dalit converts except the Pashtuns and Baloch obviously and they converted because of persecution and discrimination at the hands of upper caste hindus especially Brahmins who treated them badly, denied them equal rights like entry in temples, drawing water from wells or getting educated. Manusmriti gives a detailed account of how Brahmins and other upper castes are superior to shudras. When the islamic invaders and sufis arrived, the lower castes saw merit in converting to a religion that promised equality instead of staying in the dharmic fold as an inferior hindu. Many were converted forcibly and some converted of their own accord. Even though most were reluctant to convert, they chose life over being murderd by the islamic invaders. Once converted, they couldn't convert back to hinduism as it was not allowed at that time. Over time they embraced islam. For those who don't know, even gujjars and jats are considered shudra ( not dalits as they are outside the varna vyavastha). Most upper castes converted in the last 200- 250 years only. In some areas, conversions were peaceful but mostly they were forced. Some converted for better economic opportunities, or for avoiding paying jizya. But, all in all, had the upper castes treated all hindus equally, there wouldn't be so many muslims in Indian subcontinent.
The irony is even after converting to Islam, the lower caste muslims are considered inferior by upper caste convert muslims and pathans especially in India.