Yes, it does. It backs up certain system functions and settings (such as the clock). It's a "coin" type battery (2032, I believe). You shouldn't need to worry about replacing it for many, many years.
Since the op mentioned a "need to change it", I assumed he/she meant they knew it wasn't made to operate the iMac.