Can one take a sick fish out of water to end its suffering?
During the week this is what should be done in order to minimize the fish’s suffering. It is not tzar baalei chayim to kill an animal, but only to pain it while it is alive, and here it is being done in order to alleviate it’s pain. The Chazon Ish was once asked what to do with a fly that was wounded and suffering, and he said that it should be killed in order to minimize its suffering. Even if the fish would not be suffering it would be permitted to remove it because it is going to harm the other fish and cause them pain, besides that it will also cost the owner of the fish a monetary loss, because his other fish will also get sick.
Dinim v’Hanhagos chazon Ish 2-pg. 40, Noda B’yihuda Y:D 83.