Another theory is that trick came from the American slang term for robbery. Prostitutes, at the turn of the 20th century, often robbed their patrons with the help of thugs. It's reasonable to suggest that this association helped spawn the term.
However, it could be as simple as trick meaning a mischievous act which speaks to the taboo nature of visiting prostitutes.
While turning tricks has come to mean performing prostitution in any sense, it's most commonly applied to the work of streetwalkers rather than prostitutes employed by brothels. When turning tricks in this sense, the prostitute services their clients in their car, a nearby public space like an alleyway or a rented motel or hotel room.