But yes, you are right. It is a possibility, the probability of which varies by culture. You have to know your particular enemy. If I became a prisoner of the North Koreans, for instance, being raped would be about the last of my concerns. If I were a prisoner of the Syrians, it would probably be a close second, right behind survival.
I'm not female, however, and any female soldier should be aware that she will almost certainly be assaulted by whoever captures her.