It's called the Anti-Deficiency Act, and it was passed in the late 1800's.
The Atlantic's Andrew Cohen tracked down a few scholars to find out what that obscure law means. Basically, it prohibits the government from entering into financial obligations that they don't have the money to pay for, but it also allows the military and the courts to continue operating even if their funding has not been authorized.
Harvard Law Professor Howell E. Jackson says, under the act most federal employees will be sent home without pay - but there are some exemptions for those employees deemed to be "essential."
Perhaps the most interesting example of a "specific exemption," Jackson says, is the Food and Forage Act of 1861 -- near the start of the Civil War. As the title suggests, that law permitted soldiers to graze their horses and take whatever other necessities were required to live on horseback. It's a law that was invoked in a decidedly non-horsey sense during the Vietnam War, again during Operation Desert Shield in Iraq in 1990, and, for a brief time, immediately following the terror attacks of September 11, 2001.
"Federal employees can accept volunteers or go beyond their funding in cases of emergency involving the safety of human life or the protection of property," Westmoreland says. So federal firefighters and law enforcement officials clearly are exempt, Tiefer adds, as are judges presiding over criminal (but not necessarily civil) cases. Moreover, it's the OMB, with help from the Justice Department, that makes the call on who is essential and who is not, and each federal department, as we see above in the judicial example, has formulated its shutdown protocols.