It has also doubled the prison term for offenders to 20 years.
Activists hope the law will encourage more slaves to take legal action to secure their freedom and will encourage the courts to punish slave owners.
Mauritania abolished slavery in 1981, but activists say it is still widely practised and many in the West African country inherit their slave status.
According to the AFP news agency, the new law, passed on Wednesday, also criminalises "10 other forms of slavery", including forced marriage and handing a woman over to another man without her consent after the death of her husband.
Boubacar Ould Massoud, chairman of campaign group SOS Slavery, told the BBC it also provides for legal help for victims and enables them to seek compensation.
He said it was laughable to think that slavery did not exist in Mauritania.
"Often judges sympathise more with the slave owners than with the slaves. Slavery cases taken to court have up until now referred to the slaves as 'non-paid workers' or 'exploited and underage workers,'" he told BBC Afrique.
Anti-slavery activists in Mauritania also say they have faced harassment from the authorities.
AFP reports that three anti-slavery activists will be judged on appeal on 20 August in the central town of Aleg.
They include two members of the Initiative for the Resurgence of the Abolitionist Movement in Mauritania, a well-known non-governmental organisation.
They had been sentenced to two years in prison for "membership of an unrecognised organisation", the agency reports.
According to a 2014 survey by anti-slavery campaign group Walk Free, Mauritania has the highest number of slaves as a proportion of the population, at 4%.
Campaigners have welcomed Mauritania's new anti-slavery law which makes the offence a "crime against humanity".