To dream you are in prison denotes you are being denied freedom to express yourself.

To dream someone else is in prison suggests your lack of ability to express yourself in a particular aspect of your life.

To dream that you or someone is released from prison signifies your moving past your troubles and making a new life for yourself. Your dream conveys optimism, particularly in overcoming your adversities.