It is the law and and it should be but on the other side, a construction or cleaning company's labour is not able to protect his passport as they dont have such a safe place where they can keep their passports in their accommodation. 

It should be optional, if the employee wants to keep their passports in the company's office or with them.