Batteries have two primary uses in computing. Portable computers and devices use a battery as a power source. Lithium-ion batteries are standard for these applications, but other types such as Nickel-Metal-Hydride are also used. Most batteries used in portable computing are rechargeable.
Certain settings and memory on motherboards use a battery to keep the onboard clock powered even if the computer is powered off. Usually these are non-rechargeable cells that last 5-10 years.