The drainage of the urine is involuntary - as it is produced by the kidneys and empties into the bladder, it is drained down the catheter through some clear tubing into a collection bag. The collection bags for the most seriously ill patients have an attachment called a urimeter. This device collects and accurately measures the urine. These numbers are watched carefully. Urine output is an important measure of organ perfusion, fluid balance and kidney function, and the Foley catheter makes its accurate measurement possible.
Some conditions inhibit the bladder's ability to release urine.
In these cases, the catheter prevents the bladder from becoming overdistended and indeed from rupturing. In other conditions, such as coma, there would be no bladder control at all. The Foley prevents the patient from being incontinent of urine, which would not only make measurement difficult, but also would have serious effects on the patient's skin. Even then, they often remain up unless they are actually interfering with giving care. This is one of the strictest rules in any hospital, although it's the one you are least likely to see on any TV show, even the otherwise authentic hospital scenes in The XFiles.