The U.S. Department of Justice has issued a report on Alabama prisons. The press release is here and the transmittal letter and full report are here.
The principal problem is failure to prevent further crimes by criminals already sentenced to prison. "The Department concluded that there is reasonable cause to believe that the men's prisons fail to protect prisoners from prisoner-on-prisoner violence and prisoner-on-prisoner sexual abuse, and fail to provide prisoners with safe conditions." The fact that the victims of these crimes are mainly other inmates is not a reason to tolerate this.
Prisons should be as secure as they need to be to incapacitate criminals from committing more crimes for the duration of their term. I haven't read the whole report yet, but the incidents described in the introduction all appear to be of the insufficient security variety.

Neglegence and bigotry also seem to have played a role: "The Alabama prison system “has a tendency to dismiss claims of sexual abuse by gay prisoners as consensual ‘homosexual activity’ without further investigation, implying that a gay man cannot be raped,” the report found, adding that some inmates who reported being assaulted were asked to sign a release of liability document by prison officials." https://www.washingtonpost.com/world/national-security/cruel-and-unusual-alabama-prisons-plagued-by-severe-violence-justice-dept-investigation-finds/2019/04/03/2b0e038c-5628-11e9-9136-f8e636f1f6df_story.html?utm_term=.705b82c85962
The fundamental problem seems to be under-staffing and overcrowding. This leaves the people of Alabama with two choices. Spend more money or lock up fewer people.