The "Domestic Employment Law" also orders employers to pay staff wages at the end of each month and entitles workers to at least one day off per week and an annual leave of three weeks, the Qatar News Agency reported.
They will also receive end-of-service benefits equating to a minimum of three weeks wages for each year of service when their contract ends.
The law prohibits staff being recruited from abroad who are older than 60 and younger than 18.
Hundreds of thousands of foreign workers have flocked to the gas-rich Gulf emirate in recent years, including almost 1,00,000 women working as house staff.
Other domestic workers covered by the new law include cleaners, gardeners and drivers.
The legislation was issued on Tuesday by Qatar's emir, Sheikh Tamim bin Hamad Al-Thani, QNA reported.
Although Qatar has come under severe international pressure to improve its record on the treatment of construction workers in the run-up to the 2022 World Cup, until now domestic staff have not been protected by any legislation.
Critics have long campaigned for legal protection for domestic staff, with some claiming that they are subjected to working in slave-like conditions.
In 2014, it was reported that hundreds of Filipino domestic workers had sought sanctuary at their Doha embassy complaining of harsh working conditions.
The issue of ill-treatment of domestic staff stretches across the region.
In 2015, Indonesia said it would stop sending domestic staff to 21 Middle Eastern countries in protests at the treatment of maids in those countries.
The legislation comes at a time when Qatar's laws remain under scrutiny from the International Labour Organisation.
The UN body has given Qatar until November to improve its human rights record or face sanctions.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)