Women in sub-Saharan Africa are disproportionately affected by the HIV epidemic. Young women are twice as likely to be living with HIV as men of the same age and account for 64% of new HIV infections among young people. Many studies suggest that financial needs, alongside biological susceptibility, are a leading cause of the gender disparity in HIV acquisition. New robust evidence suggests women adopt risky sexual behaviours to cope with economic shocks, the sudden decreases in household's income or consumption power, enhancing our understanding of the link between poverty and HIV. We investigated if health insurance protects against economic shocks, reducing the need for vulnerable women to engage in risky sexual behaviours and reducing HIV and sexually transmitted infection (STI) incidence. We conducted a randomised controlled trial to test the effectiveness of a formal shock coping strategy to prevent HIV among women at high risk of HIV (registration number: ISRCTN 22516548). Between June and August 2021, we recruited 1,508 adolescent girls and women over age 15 years who were involved in transactional sex (n = 753) or commercial sex (n = 755), using snowball sampling. Participants were randomly assigned (1:1) to receive free health insurance for themselves and their economic dependents for 12 months either at the beginning of the study (intervention; n = 579; commercial sex n = 289, transactional sex n = 290) from November 2021 or at the end of the study 12 months later (control; n = 568; commercial sex n = 290, transactional sex n = 278). We collected data on socioeconomic characteristics of participants. Primary outcomes included incidence of HIV and STIs and were measured at baseline, 6 months after randomisation, and 12 months after randomisation. We found that study participants who engaged in transactional sex and were assigned to the intervention group were less likely to become infected with HIV post-intervention (combined result of 6 months post-intervention or 12 months post-intervention, depending on the follow-up data available; odds ratio (OR) = 0.109 (95% confidence interval (CI) [0.014, 0.870]); p = 0.036). There was no evidence of a reduction in HIV incidence among women and girls involved in commercial sex. There was also no effect on STI acquisition among both strata of high-risk sexual activity. The main limitations of this study were the challenges of collecting reliable STI incidence data and the low incidence of HIV in women and girls involved in commercial sex, which might have prevented detection of study effects. The study provides to our knowledge the first evidence of the effectiveness of a formal shock coping strategy for HIV prevention among women who engage in transactional sex in Africa, reinforcing the importance of structural interventions to prevent HIV. The trial was registered with the ISRCTN Registry: ISRCTN 22516548. Registered on 31 July 2021.