China is to end a punishment system for prostitution that allowed police to hold sex workers and their clients in custody for up to two years at so-called education centres.
Detainees were forced to work, allegedly making toys and household goods.
The detention system will come to an end on 29 December. Those still in custody will be released, according to Xinhua, China's state media.
Prostitution remains illegal in China.
It carries punishments of up to 15 days in detention and fines of up to 5,000 yuan (£546).
China's state media claims the "custody and education" system has helped to maintain a "good social atmosphere and public order" since it was introduced more than 20 years ago.
It added that over time, the system has become less and less appropriate.
A study by NGO Asia Catalyst in 2013 questioned whether this scheme was effective.
The report included interviews with 30 female sex workers from two cities.
It claimed detainees were unable to learn new skills during detention that could help them after their release. The report added that the detainees typically undertake manual labour.
It said: "All of the sex workers we interviewed returned to the sex trade immediately after release."
A 2013 report by Human Rights Watch interviewed 140 sex workers, clients, police and specialists and found that many sex workers were beaten by police in an attempt to coerce confessions.
One worker claimed she had been deceived into signing a confession.
"The police told me it was fine, all I needed to do was sign my name and they would release me after four or five days," she said.
"Instead, I was locked up in [a] Custody and Education centre for six months."
Shen Tingting, director of Asia Catalyst, said the move to abolish forced labour detention centres is positive but only a small step towards safeguarding the rights of sex workers.
"Chinese law and policies focus on prohibition and cracking down on sex work, rather than providing a framework to ensure the health and safety of sex work as a profession," she said.
In 2013, China announced it had abolished its system of "re-education through labour camps" for petty criminals.
That decision came after several high-profile miscarriages of justice, including a case where a mother was sent to a labour camp after demanding justice for her daughter who had been raped.
However, the abolition did not extend to the "custody and education" system affecting sex workers and their clients.
China isn't totally abandoning the idea of re-education. Authorities in the country claim a number of camps in the north-west region of Xinjiang are voluntary education camps that help to combat extremism.
However rights groups claim many Chinese Uighur people have been rounded up into the camps and made to criticise or denounce their faith.