Smoke alarms don’t last forever. Many alarms have a recommended service life of around 10 years, after which the entire unit should be replaced, not just the battery.
Check the manufacturer’s information on your existing alarm or have an electrician assess it if you’re unsure how old it is.