Prison rape is evil and i suspect officially, unofficially condoned. Prisons are 100% control environment where inmates rely necessarily on the institution for safety. In fact prisoners are n the custody of the State, and everything that implies.
That prison rape and violence is commonplace and encouraged by many as extra judicial punishment is wrong.
I guess it is good thing you have obviously not spent anytime in prison. The inmates run the prison, they determine who is safe or not, and they allow people to be hurt when they chose. Sometimes, the guards may intervene before something bad happens, but mostly they do not know what is about to happen. The government only manages who comes and goes, and government is in no way 100 percent in control of the place. Drugs, homosexuality, beatings, rapes, are just a few ways the inmates control what goes on. Guards are bystanders, and frankly, they are not paid enough to risk being hurt by intervening.