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 centers.
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 sex workers 'abused by police'
China issues tough online rules
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 labor.
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 center for six months."
The world's largest licensed brothels
Shen Tingting, director of Asia Catalyst, said the move to abolish forced labor detention centers 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 labor camps" for petty criminals.
That decision came after several high-profile miscarriages of justice, including a case where a mother was sent to a labor camp after demanding justice for her daughter who had been raped.
However, 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 criticize or denounce their faith.