For a ruse or trick to be discovered; to be caught.
Sometimes, a person will see straight through a practical joke before it has finished. In such cases, they might yell the phrase "the jig is up" as a way of letting everyone know they've figured out what's really going on.
The phrase's origins apparently come from a time where the word jig was slang for a trick. Additionally, the Facts on File Encyclopedia of Word and Phrase Origins, by Robert Hendrickson, states that this expression was used during Elizabethan times (mid-to-late 16th century), where the word jig became slang for a practical joke or trick. Thus, if "the jig was up," it meant your trick was found out, or exposed.
That era is where the phrase is believed to derive its meaning from.
Reference: The Facts on File Encyclopedia of Word and Phrase Origins
Note: The origins for most idioms and common sayings cannot be said with a certainty. What's provided are theories that may be plausible to how a phrase originated, but not necessarily so.
In addition, quotes that contain a particular phrase may be taken from old newspapers, poems, or books that were written centuries ago, but this by no means confirms that the phrase originates from said newspapers, poems, or books. In all likelihood, if an expression is being used in a newspaper, it's probably already a well known saying and is from an older time.
* Ron found himself on a hidden camera show that had people pretending to yell and fight each other, but the jig was up when he realized things were becoming a little too bizarre for it to actually be real.