There are numerous reasons why a prisoner will be transferred to a different facility. Here they are in order of importance:
1.) Overcrowding
Prisons filled with too many inmates will transport inmates to other facilities in order to gain room for other arriving prisoners.
2.) "Upgrading" from State to Federal
If a criminal is currently being tried, they will place him in the state prison. If they convict him/her of a crime of higher importance, he will be moved from State to Federal prison. If not, he will stay in State. Please remember there are a three levels of prison: County, State, and Federal.
3.) Shaking Inmates from their Gang ties
Many inmates go in with gang ties, so they will transfer them so the presence of a certain gang is not as overpowering as to where they could harm guards.
4.) Inmate Safety
If an inmate is not safe from other inmates (mostly molesters and rapers) or they pose a danger to other inmates (mostly serial killers or terrorists), they will move him/her to a facility where they cannot harm/be harmed.
Hope this helped!