Yes, there is a law for domain squatting and it is called as Anticybersquatting Consumer Protection Act (ACPA) of 1999. This law is of the United States, however, this law is followed all over the World for domain squatting. Also, in major cases, a complaint can be launched to ICANN (Internet Corporation for Assigned Names and Numbers).
According to ICANN, if the domain is registered already, no domain registrar has the right to register the same domain name again.
Hope this helps
