Whether it is necessary to disconnect the solar panels or not when batteries are disconnected depends upon two things: the Open Circuit Voltage of the solar panels, and the Maximum Input Voltage of the charge controller. If the Open Circuit Voltage is less than the Maximum Input Voltage, it is not necessary to disconnect the solar panels.
The Open Circuit Voltage is considerably greater than the Operating Voltage of a solar panel. Sometimes solar charge controllers are installed that are OK with the operating voltage, but not OK with the open circuit voltage. As long as batteries are installed, the Operating Voltage is what the charge controller receives. When the batteries are disconnected and therefore no load on the solar panels, the Open Circuit Voltage is what the charge controller receives.
The solar panel Operating Voltage and Open Circuit Voltage, as well as the charge controller Maximum Input Voltage will all be listed in their specification sheets.