How old is the RV/detector? Many detectors will go off (or at least beep sporadically) if they believe they are at the end of their life and need replacement.
I would very much doubt its gas from the batteries setting it off. If you're getting sufficient gas from the batteries into the living space of the RV to set off any alarm, that in itself is a problem to fix by sealing the battery bay from the living space better. Acid fumes in living spaces are not really a good thing.
You could pretty well verify that the solar is unrelated by disconnecting the solar panels from the controller (or seeing if you continue to have problems at night).