Unfavorable water conditions such as the presence of ammonia and/or nitrites in the water would be the primary suspect in causing a fish to gasp for air. The way to verify this is by testing the water for levels of ammonia and nitrites. If you don't have a test kit handy then a water sample can be brought to your local pet shop where they will usually test for free. Results should indicate ammonia=ZERO and nitrites=ZERO. Both are harmful and often lethal to fish. If testing shows that they are indeed present then a series of daily 20% partial water changes would be in order until they are eliminated.
Another cause for gasping would be lack of sufficient oxygen in the water. This can be resolved by adding an air stone(s) to the tank.
Yet another possiblity that would cause gasping is if the fish had a disease centered in its gills such as gill parasites or bacteria. In this case treating with the proper medicine would be the appropriate course of action but before administering any medicine I would rule out the prior two possiblities first.
Best wishes.
.
YOUR TROPICAL FISH RESOURCE
OVER 20 YEARS EXPERIENCE W/TROPICAL FISH---BREEDING, MAINTAINING, CURING