Most computers have a small battery. In many cases the battery is soldered directly onto the motherboard, but the battery is usually in some sort of holder so it is easy to replace. Computers are not the only things that have a small battery like this -- camcorders and digital cameras often have them too. Just about any gadget that keeps track of the time will have a battery.
In your computer (as well as other gadgets), the battery powers a chip called the Real Time Clock (RTC) chip. The RTC is essentially a Quartz Watch that runs all the time, whether or not the computer has power. The battery powers this clock. When the computer boots up, part of the process is to query the RTC to get the correct time and date. A little quartz clock like this might run for 5 to 7 years off of a small battery. Then it is time to replace the battery.
This does not explain why your computer would not boot, however. You would expect the computer to boot fine but have an incorrect time and date. The reason your computer would not boot is because the RTC chip also contains 64 (or more) bytes of Random Access Memory (RAM). The clock uses 10 bytes of this space, leaving 54 bytes for other purposes. The BIOS stores all sorts of information in the CMOS RAM area, like the number of floppy and hard disk drives, the hard disk drive type, etc. If the CMOS RAM loses power, the computer may not know anything about the hard disk configuration of your machine and therefore it cannot boot.
Many more modern computers are not quite so dependent on the CMOS RAM. They store the settings in non-volatile RAM that works without any power at all. If the battery goes dead, the clock fails but the computer can still boot using the information in the non-volatile RAM area.
Here are two interesting links: