If you're talking about animals in zoos, then yes they should be put back into their natural environment (with protection if endangered) instead of being held hostage in cages. If you're talking about dogs and cats in "captivity"(houses) then no. They were bred to live with humans, and the outside world, with cars and crazy people with guns, is dangerous for them.
Unless wildlife is kept in a way that the animals do not imprint on humans, it is not right to release them into the wild. In many cases, animals raised in captivity will not learn the skills they need to be wild. They will not know how to join a social group. They should be kept in captivity for their own safety.
No, animals that have been kept in captivity should not be released into the wild. It is actually dangerous to these animals to be released into the wild. They do not know how to survive in the wild the same way that animals that have not been kept in captivity know how to survive.
Animals in captivity have grown accustomed to that lifestyle and can not fend for themselves as they have been spoiled by the humans who have captured them. To release them back into the wild is a disservice to them because they run the risk of getting killed more easily and not being able to properly fend for themselves.
Animals that have had more than a handful of days of captivity lose many of their survival skills. Zoos and wildlife rehabilitators can provide many examples of animals that cannot be released, either because they no longer fend for themselves or they look to humans as suppliers of food and security. An animal that has been in captivity and released will either not survive, or will return to humans -- even bears in national parks, still theoretically "wild," if fed by humans, do this.