People are locked in jail cells when they do something wrong. Animals are locked in a cage because they are beautiful to look at, have valuable parts, or are endangered.
Some domesticated animals are in cages because they did something wrong as well, or because their owners do not trust them to be alone.
Either way, animals and humans are both confined when it is in their DNA to be free, so yes, it can cause mental issues.
Wild Animals will not be the same if confined for a long time,
Humans will not be the same if confined for a long time.
Both will have trouble adjusting to life outside of bars if they are ever freed.