A solar panel’s rating is determined by the battery’s rating. A 12V solar panel should be used with a 12V battery and a 24V solar panel with a 24V battery.
It’s worth noting that while a 24V battery isn’t readily accessible, you can make one by connecting two 12V batteries in series however, it will cost significantly more than a 12V setup.