That is usually a reaction to bad water quality. If you can test water, do so. But, even if you can't I would do some big water changes. Other options include internal bacterial infection or chemical poisoning. It is hard to say if it is contagious, because that us not an uncommon symptom.