Hello and welcome to JustAnswer!
The battery light comes on when the battery is either overcharging or undercharging. usually it's because it's undercharging due to a bad alternator.
Possible causes for the light would be the powertrain control module (PCM), wiring, the alternator, battery, or connections. Some electrical testing will need to be done to determine what is happening. You may also be able to remove the alternator and have it tested at a parts store, but if it tests ok it could still have an intermittent problem and still need to be replaced. Most likely the alternator is what is causing the light to come on.