A cough was a mechanism for expelling foreign substances from one's throat and lungs.
In 1893, Data cautioned a coughing bellboy about cholera. (TNG: "Time's Arrow")
In 2154, a silicon-based virus caused Trip Tucker and Hoshi Sato to have a coughing fit. Later, Doctor Phlox gave them a cough suppressant. (ENT: "Observer Effect")
In 2366, an environmental system malfunction on the bridge of the USS Enterprise-D released toxic levels of nitrogen oxide which caused the bridge crew to cough. (TNG: "Evolution")
In 2370, Geordi La Forge coughed as a psychosomatic response to seeing gases inside a ship he was exploring remotely. (TNG: "Interface")
That same year, Dr. Julian Bashir told Miles O'Brien to cough as part of a physical. (DS9: "Whispers")
In 2371, Leeta faked a cough in order to see Bashir. He "prescribed" a Fanalian toddy for her, then ordered one for himself, saying he was also feeling a cough coming on. (DS9: "Explorers")
Coughing could also be a way of announcing one's presence. In 2366, William T. Riker coughed to interrupt La Forge and Christy Henshaw's romantic interlude in the turbolift. (TNG: "Transfigurations")