The phrase comes from people living in isolated mountain communities. In winter, if local game was scarce, wolves would occasionally venture into yards in response to food smells, and could be heard sniffing around outside. Thus, if you keep a wolf fed, you keep him from the door, and the phrase means keeping yourself busy with enough money to feed your household.