Suzanne Terry of Môregloed and Elizna Rochelle of Mollendorf in Eersterust secured the order in the High Court in Pretoria on Tuesday.
Tshwane had ended its training agreement with the two student constables on May 22 because the pair ignored an order to cut their hair short.
Their instructor Ramatsimele Ndlovu then forcibly cut their hair on the parade ground last December.
Ndlovu has since been fired after a disciplinary hearing.
Tshwane had argued that both male and female recruits were told on December 2, when training started, that those with long hair needed to cut it short and that men needed to shave off their beards.
But the court declared it was irregular to end the training contract with the two woman and made a cost order against Tshwane, Beeld reported.