This is not an all-encompassing law and has been introduced at the moment only in the state of Maharashtra. The Prohibition of People from Social Boycott (Prevention, Prohibition, and Redressal) Act 2016 makes social boycott in the name of religion a criminal offence. Here's link to an article explaining the law:
This may come in handy for anyone in the state of Maharashtra, who is or will in future be shunned. Attempts are being made to make this a national law.