If your wife kicks you under the table or otherwise makes it plain to you that it would be best not to go on with what you were about to say, you may, she hopes, understand that she’s trying to head you off from “putting your foot in it,” from committing a social blunder or doing something that had best be left unsaid or undone.
The figurative phrase was in current use in the latter part of the eighteenth century, but what the original allusion was is anyone’s guess.
Personally, because such a blunder fits so patly, we have always been taken by an old rancher’s literal description of a hand he had recently hired:
“I declare, he’s such an ass that if there was just one cow-flop in a ten-acre field he’d be sure to put his foot in it.”