We examine the impact of criminalizing sex work, exploiting an event in which local officials unexpectedly criminalized sex work in one district in East Java, Indonesia, but not in neighboring districts. We collect data from female sex workers and their clients before and after the change. We find that criminalization increases sexually transmitted infections among female sex workers by 58 percent, measured by biological tests. This is driven by decreased condom access and use. We also find evidence that criminalization decreases earnings among women who left sex work due to criminalization, and decreases their ability to meet their children's school expenses while increasing the likelihood that children begin working to supplement household income. While criminalization has the potential to improve population STI outcomes if the market shrinks permanently, we show that five years post-criminalization the market has rebounded and the probability of STI transmission within the general population is likely to have increased.