There is no such thing as a “solar” battery. There are batteries, of different types, that people use to store electricity generated from solar panels. They are generally the same types of batteries used in other products for storing electricity – including EVs, car starter batteries, and consumer electronics.
How long they can hold a charge depends very much on the specific type of battery – what chemistry is used in the battery, and what conditions the battery is exposed to (temperature, etc).
A very popular battery type used for solar today is lithium-ion. Lithium-ion cells will typically discharge a few percentage points a month (A novel and fast method of characterizing the self-discharge behavior of lithium-ion cells using a pulse-measurement technique). So, in theory, it could take years for a battery to fully self-discharge. But, the exact details are going to be highly dependent on the specifics of your situation.