To reveal a secret or a surprise by accident.
Credit: Lisa, via Wikimedia Commons [CC BY-SA 2.0]
Etymology
It is not very clear : two suggestions are that the phrase refers to « the cat o’nine tails » or « the pig in the bag» scam*.
The first origin story comes from the British infamous Royal Navy, when sailors who did not perform their duty, were beaten with a cat o’nine tails (a whip with nine knotted cotton cods). The cat was kept in a red cloth bag. Now when the cat was taken out of the bag there was no secret about what would happen next.
Another possible explanation for the origin of this idiom comes from the fact that all sorts of livestock** were traded in open-air market including pigs. Unscrupulous sellers would sell a cat in a bag instead of a pig and instructed the buyers not to open it until they get home as the pig would escape.
Well, honestly piglets tend to be a lot heavier that even the fattest cats and moreover pigs oink while cats mew! It would be pretty hard for even the stupidest of buyers to mistake a pig for a cat.
However, anyone who has ever got a cat into a bag knows that once out, it will not go back, suggesting the irreversibility of a told secret !
Wrong translation
> Laisser le chat sortir du sac
Correct French idiom
> Découvrir le pot aux roses
> Vendre la mèche