Sort:  

Why would a law like that even exist?

it was inherited from the Indian Penal Code and was in place while the country was still under colonial rules