In spite of what you may have heard from some press (P.E.T.A. and Snorkel Bob, on Maui, come to mind) statistically, fish will live longer in a well maintained marine aquarium than in the wild.
The primary reason that fish die in the wild is through predation by other fish, not disease or starvation or old age. Because of the immense size of the oceans, it is very difficult to get a good "plague" of any kind going in the oceans. You seldom see a true outbreak of parasites or any disease in the wild, due again to the size of the ocean and the fact that nature has provided a number of "parasite pickers" and carnivores to take care of most problems in their infancy. In the wild, when a fish starts slowing down due to disease or old age, it gets eaten ("survival of the fittest").
Aquariums are a whole different story, though. A vast majority of salt aquariums are "closed systems" (not open to the ocean) and depend wholly on human intervention to keep the critters alive and healthy. Back when saltwater aquariums were in their infancy, the fish population took a lot of hits, due to the lack of knowledge of what the fish and invertebrates required. Fish didn't stay alive for very long. But, the science of saltwater aquaria has come a long, long way, particularly in the last few decades.
All that being said, fish, invertebrates, and corals do die in marine aquariums. The major causes of fish dying in aquariums are the following.
Starvation and Diet
New arrivals have a much greater chance of not eating hand fed foods for 2 reasons. First, many of the fish have not been properly fed from the time they were caught until the aquarist puts them in their tank. The collectors normally don't feed what they catch because it will make the fish poop in the shipping bag. Poop in the shipping bag equals ammonia in the water, which means less O2 in the bag and burnt fins and gills.
For the most part, sick fish don't eat. Also, many aquarists don't offer the fish the food that they normally eat. Mandarinfish are a perfect example of this. Mandarinfish normally eat copepods and amphipods in the wild. They will not take any interest in that flake food you try to tempt them with. There are methods for getting finicky fish to eat, but that is a topic for another article. When a fish hasn't eaten for a while, they have a tendency to lose their appetite and it may be difficult to get them to start eating again, even if a desirable food is presented.
Many aquarists do not acclimate their fish properly. They might adapt them to the temperature difference between the bag water and the aquarium water, but they don't take the time to adapt them to the difference in pH. Some fish (and many invertebrates) are more sensitive to pH change than others. Taking the extra time to slowly adjust the pH will eliminate many critter deaths in an aquarium.
Parasite and Disease
Many fish (particularly surgeonfish) carry parasites (i.e. oodinium and cryptocaryon) hidden away in their bodies. They may not be apparent when you receive them, but stress from capture and shipping can cause an outbreak in your tank shortly after you put them in your tank. Fortunately, most fish diseases are curable if they are caught in their early stages and treated with the proper remedy. Quarantine tanks are highly recommended for new marine fish arrivals before placing them in your main tank. The parasites, in and of themselves are not the actual "cause of death." The actual cause of death is usually suffocation resulting from the mucus that the fish produces in the gills as a result of the parasite boring into the gills. Quite often, even if the actual parasites are killed, the resulting lesions become infected, causing death.
No matter how much you might wish otherwise, a Volitans Lionfish will eat any fish it can get in its mouth. That might seem like an extreme example, but many other fish species will just not get along with certain other (or even some of their own) species. Using a good compatibility chart to see what probably won't work together in your tank before you buy a new addition will save you a lot of time and money.
Poor Water Quality
In order to survive, fish require an environment that is stable and within certain parameters. These parameters include proper salinity level, pH, low to no ammonia, and nitrites. Poor water quality contributes to immunological weakness, infections, and general poor health. Weak fish are a good target for other fish to pick on. Proper water quality can be maintained by a number of means: partial water changes, proper filtration, the addition of trace minerals, regularly balancing the pH and not overstocking the aquarium.
Understandably, beginning aquarists lose more fish than experienced aquarium keepers. Particularly with saltwater aquariums, there is a lot to know and the learning curve is pretty steep, to begin with.
It should be mentioned here that many problems in hobby (and others) marine aquariums are the end result of poor capture and shipping procedures. By the time a fish arrives in your LFS's display tank, it has gone through a lot of hands and been in a number of shipping bags. Normally, the collector catches the fish, takes it to a shipper, who puts it in a bag and ships it to a trans-shipper or wholesaler, who puts it in his system, then re-bags it and ships it to your LFS. Knowing what to look for when purchasing fish will help you to avoid buying a specimen that will present problems in the future.
Got a Sick Fish?. American Veterinary Medical Association, 2020
Fish—Healthy Pets, Healthy People. Centers for Disease Control and Prevention, 2020
Selecting A Pet Fish. American Veterinary Medical Association, 2020
Water Q&A: What Causes Fish Kills?. U.S. Department of the Interior, 2020
The Ornamental Fish Trade: An Introduction with Perspectives for Responsible Aquarium Fish Ownership. University of Florida Institute of Food and Agricultural Sciences, 2020