Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
1- If the prisoner is being held in a prison far away from the place where he lives, further than the distance at which shortening prayers becomes permissible, then he comes under the ruling on travelers.
2- If he does not know when he will get out of prison, he may shorten his prayers and combine them when there is a need to do so, until he gets out of prison or finds out that he will remain in prison for more than four days.
3- Those who are in prison are not obliged to offer Jumu`ah (Friday Prayer) when they are in their dormitory. If they are able to offer this prayer in the mosque of the prison, then it is obligatory in that case.
Answering your question, the Fatwa Center at Islam Q and A, states:
If the prisoner is being held in a prison far away from the place where he lives, further than the distance at which shortening prayers becomes permissible, then he comes under the ruling on travelers.
If he does not know when he will get out of prison, he may shorten his prayers and combine them when there is a need to do so, until he gets out of prison or finds out that he will remain in prison for more than four days.
If he finds out that he will stay in prison for more than four days, then the concessions of travel are not applicable in his case, according to the majority of jurists.
The distance of travel for which the concessions of travel apply, according to the majority of jurists, is approximately eighty kilometers.
Whoever sets out to travel this distance or more may avail himself of the concessions of travel, such as wiping over the leather slippers or socks for three days and nights, combining prayers, shortening prayers, and breaking the fast of Ramadan.
If a traveler halts in a city but does not know when he will complete the purpose for which he traveled, and has not decided upon a specific length of time for his stay, he may avail himself of the concessions of travel even if he remains there for a long time.
Those who are in prison are not obliged to offer Jumu`ah (Friday Prayer) when they are in their dormitory. If they are able to offer this prayer in the mosque of the prison, then it is obligatory in that case.
The people in each dormitory should offer the five daily prayers in congregation in their dormitory, if they are not able to pray in the mosque of the prison.
If these people have been imprisoned because of sentences that have been passed against them, and they are staying in the prison to serve their sentences, then they come under the same rulings as people who are resident in a place, and they have no concession which would allow them to shorten the prayers or combine them, or to break the fast of Ramadan, but they may pray in congregation, each group praying in its own dormitory.
They are not obliged to pray Jumu`ah unless the prison administration gives them permission to pray in the prison mosque, in which case it becomes obligatory.
But if they are in a situation where they do not know where they will be tomorrow, and the administration of the prison usually moves them from one city to another, then in that situation they may avail themselves of the concessions of travel, and it is permissible for them to shorten prayers and combine them.
We ask Allah to bring about the release of those who have been imprisoned unjustly, and to relieve the distress of those Muslims who are facing hardship.
Almighty Allah knows best.
Source: www.islamqa.info