The most effective safeguarding measure against this for female prisoners is the segregation of inmates by sex.
SB132 has demolished this protection for women in Californian prisons and, as the linked articles discuss, we now see the awful and entirely avoidable consequences of this law, within just a few years of it being enacted. Exactly as women's rights advocates made legislators aware would happen in their unfortunately futile efforts to halt SB132 from being passed.