A law court in a dream may make you focus on your capacity to make fair judgments in complicated matters concerning work, friends or family members. It may also highlight your feelings of being on trial in waking life, or a sense of guilt about having broken a promise, or a moral or social law. Perhaps you are anxious about being judged by others or feel that there something that you should be punished for.
If you find yourself bundled into prison in your dream, perhaps with the clang of heavy gates swinging shut in your ears, this may be drawing a parallel with your sense of confinement in waking life. So, if you have any kind of dream about prisons or being jailed, ask yourself who or what is restricting your freedom in waking life. Do you feel suffocated emotionally by your partner or parents, or do you feel trapped in a dead-end job? Or has your own shyness locked you into a self-made prison in the waking world?
[1]