I would say that, before anything, you need to find out what your water conditions are like. Ammonia, ph, etc. etc. There could be dozens of reasons why the fish is hurting. Was it just added to the tank? What are the other tank-mates? Is there any signs of physical damage to the fish? Did you recently add anything new to the tank? Like a new piece of driftwood, plants or other decorations? The list of questions goes on and on.
It does sound serious though, fish don't normally swim on their sides. The odds are that by time we narrow this down a bit, the fish will have already expired.