This is how you upset someone’s plans or ruin their chance for success, perhaps by withdrawing previous support.
Grammarist says the phrase originated in the early 20th century, in America, though their examples are recent.
Etymonline does not provide citations, but says “pull the rug out from under (someone) “suddenly deprive of important support” is from 1936, American English. Earlier in same sense was cut the grass under (one’s) feet (1580s).”
I guess old phrases never die, they just get reworked.