The simple answer to “Can pet fish get worms?” is yes, they can. Just like any animal, parasites can infect fish, even though tropical fish are more likely to get them. There are two main types of parasites that can infect pet fish, they are roundworms and tapeworms. The most common problem is that you can not always tell that they have them, meaning that if you buy a new fish that has them, and introduce them into your aquarium, you could well infect the rest of the fish.
If you do find that your fish have worms, you need to treat them as soon as possible, as they can have severe side-effects, and may even kill your fish. Treatment of worms in fish is pretty simple; ensure that the tank is cleaned regularly, and properly clean before treatment, then add Levamisole into the water. This treatment is usually very effective, and you should consider using it as a regular routine.