If a goldfish has trouble righting itself, the fish has a swim bladder concern. Swim bladder is symptomatic of underlying problems, rather than a specific disease. Different causes of swim bladder issues have different treatments.
All fish react poorly to sudden changes in water conditions. Rapid shifts in pH, temperature or nitrogen content can cause shock in goldfish. This shock can cause problems with a goldfish's swim bladder. Typically, fish recover on their own, though turning off the aquarium lights can help keep them calm while they recover. You can prevent shock by slowly acclimating goldfish to new aquariums. When introducing goldfish to new tanks, put the goldfish in a bucket with their old water -- some from the old tank or the water it comes with from the store. Over the course of hours, slowly add water from the new aquarium into the bucket to allow the goldfish time to adapt to their new tank's water before you add them to the aquarium.
Infection can cause swim bladder trouble, which gives an affected fish an improper float. In most cases, bacterial infections can infect the swim bladder and damage it directly. More rarely, larger internal parasites, like worms can physically press on the swim bladder. You can deal with this issue with topical medications purchased from the pet shop. Always follow the manufacturer's instructions to the letter, since aquarium medications can be dangerous if misused. Infections tend to happen when water conditions are less than optimal. Keeping up on your monthly water changes help prevent fish infection.
Goldfish rarely fight, and should not be kept with aggressive fish. However, if they are, goldfish may have swim bladder injuries after getting injured. In this case, you need to remove the aggressive fish, and provide good quality water through water changes to encourage the goldfish to heal.
Sometimes, serious constipation can lead to pressure on the swim bladder and make it hard for a goldfish to swim straight. To overcome this, feed the goldfish brine shrimp, Daphnia or bits of green pea. This will help flush out their digestive systems and relieve pressure.
Goldfish have been selectively bred for centuries. Some artificially bred varieties have unusual body shapes and misshapen swim bladders as a result. Unfortunately, this makes certain fat-bodied variates of goldfish prone to swim bladder disease. If swim bladder problems result from birth defects, nothing can be done for the fish.