The offence under Section 377 IPC has been held to be constitutionally valid by a recent decision of the Supreme Court (11 December 2013), reported vide Suresh Kumar Koushal v. Naz Foundation, (2014) 1 SCC 1. Therefore, any person violating the provisions of Section 377 IPC may be charged for that offence.
Section 377 IPC is reproduced below for a ready reference:
“377. Unnatural offences.—Whoever voluntarily has carnal intercourse against the order of nature with any man, woman or animal, shall be punished with imprisonment for life, or with imprisonment of either descripttion for a term which may extend to ten years, and shall also be liable to fine.
Explanation.—Penetration is sufficient to constitute the carnal intercourse necessary to the offence described in this section.”
The definition clearly shows that an act in violation of this section, even if that be by consent of the parties, will attract the offence.
In fact, in the above decision vide Suresh Kumar Koushal v. Naz Foundation, (2014) 1 SCC 1, the Supreme Court has also clearly held that (para 60, page 65, of SCC):
“…we hold that Section 377 IPC would apply irrespective of age and consent. It is relevant to mention here that Section 377 IPC does not criminalise a particular people or identity or orientation. It merely identifies certain acts which if committed would constitute an offence. Such a prohibition regulates s*xual conduct regardless of gender identity and orientation.”
Thus, the SC has also made it clear that consent is irrelevant to make out an offence under Section 377 IPC.
It is, of course, a different issue that the police may not be taking action in many such cases due to their ignorance of law or due to lack of interest or due to lack of information / complaints.
However, to reply to another query of yours, it may be added that, the fact remains that the police has the power to take a suo motu action in these matters and moreover, even a third-party can also lodge a complaint for such offence.
Another query raised by you is with regard to marriage of such persons (of the same s*x). As rightly pointed out by someone else, same-s*x marriages are not recognized in India. Of course, the law does not restrict living together of two willing adult persons, provided it does not constitute an offence under any provisions of law; and, of course, even in such cases, merely the fact that two persons are living together would not mean that they are legally recognized as “married” persons. And, it goes without saying that any violation of the provisions of Section 377 IPC by such persons “living together” may attract offence under that section, and such action can be taken by police suo motu or on the complaint of a third person.
What is stated above is the latest legal position in India.