Your cat coughs for the same reasons you do: He has something irritating the back of his throat, breathing passages or lungs. The body's reflex is to cough in order to get rid of whatever is causing the discomfort. Of course, you can choose to cough, too; it's not an involuntary reflex. When a cat coughs, it could indicate anything from a hairball to heart trouble. First, you need to try to determine what type of cough your cat has: dry, hacking, moist, wheezing or gagging.
If your cat has a cold or the flu, you can treat it with an over-the-counter cough suppressant, although you should check with your veterinarian first for recommendations and dosage. If the cat's cough is accompanied by pawing or head shaking, he might have something stuck in his throat. See if you can open the cat's mouth and check whether you can spot something caught in his mouth or throat. If there is something, pull it out carefully. Keep an eye on your cat for the next few days to make sure he's okay. If you can't get the foreign object out, take your cat to the vet immediately. Sometimes when a cat's collar is too tight, it might also make him cough. Double check that you can easily fit the tip of your finger between your cat's collar and his neck.
If you don't know what the source of your cat's cough is and it doesn't go away after about 24 hours, or if he's also wheezing, has shortness of breath or bluish gums and tongue then you should take him to the vet to be checked. Any other serious cough-related symptom should be treated by a veterinarian, too. Coughs are pretty much always indications of some other problem; normally they're nothing to worry about, but sometimes a cough can point to a more serious issue.