A foul was an action considered illegal within the context of a sport. Players could be penalized by temporary or permanent removal from the game, which afforded the fouled team a chance to score.
In 2152, a water polo player from Texas, number 8, fouled one of Jonathan Archer's players, resulting in a twenty-second ejection. Trip Tucker questioned whether that was fair, as it would give Archer's team an advantage, but Archer explained that was the point of the penalty. (ENT: "Vox Sola")
In 2268, Spock nerve pinched his opponent in the 892-IV gladiatorial games, prompting the Master of the Games to call it a foul. He asked Proconsul Claudius Marcus to rule on the matter, but the proconsul deferred to Merikus, who deferred it back. Claudius then rhetorically asked James T. Kirk's opinion. (TOS: "Bread and Circuses")
In 2375, Benjamin Sisko committed a baseball foul during the Niners' game against the Logicians, by making contact with the umpire, Odo. The Changeling subsequently ejected him from the game, in accordance with rule number 4.06, subsection a, paragraph 4. (DS9: "Take Me Out to the Holosuite")