Well, this is the wrong site to ask this (it's not programming related), but here goes: the battery is primarily needed to drive the RTC (real time clock) which needs to keep running even if the computer is powered off.
The BIOS often has a dedicated RAM which stores the settings, and the battery is needed to preserve this RAM as well. Information in RAM is not stable and "decays" and thus need to be read and stored again to keep the information. This called a memory refresh. You obviously need power for that, thus the battery. So if you remove the battery and the power is off, the RAM can't be refreshed and the information in it is lost.
However, AFAIK most modern BIOS chips have NVRAM (non-volatile RAM) which is able to keep the settings even without a battery. I remember that on one mainboard I had there was a jumper that you had to close to actually make the BIOS clear the NVRAM (and thus go back to factory default settings), since there was no battery.
I've also seen mainboards that use special capacitors instead of batteries.