That is based on the assumption that OP quote is a general claim rather than within the context of abortion. I strongly suspect that Ms. Harris made that tweet in the context of abortion since it was a reply to Trump's SOTU where he talked about asking Congress to pass legislation to prohibit late term abortion. I can find no reference to sex workers or sex work or prostitutes in that speech.But that's unrelated to anything which Harris did or the topic of the thread. She helped pass the law in question towards the end of her term as AG.
The hypocrisy is about her avocation for this new law which she helped enact. It's not about her enforcing some law which just happened to be on the books while she was in the office.
Of course that's the context in which she made that quote. Nobody is contesting that.
What's being said is that her opposition to laws restricting access to abortion is based on her position that the government shouldn't be telling women what to do with their bodies. If that is her actual position, then it was hypocritical of her to champion the passage of a law which essentially tells women what to do with their bodies because it severely hampers their ability to make the choice to use their bodies in the sex work industry.
If that's not her position and her actual position is that the government shouldn't be telling women what to do with their bodies unless they choose to do something she doesn't want them to be doing, in which case the government should be telling them what to do with their bodies, then she should specify this position more clearly.