In many cases a diode is used in that position to prevent current flowing from the battery into the solar panel when there is no light on the panel.
As pointed out by Benjamin the diode at the battery will prevent this and in my opinion makes the diode connected to the panel unneeded.
The panel output will not go negative, but it can go down to zero.
In practice a solar panel acts as a number of forward biased diodes in series (typically 30-36 for one used in a 12V system) and will not conduct significantly until the voltage gets up to ~0.5V per cell, ~15-18V for a panel.
However the series diode can also useful as a safety measure to avoid the battery voltage going to the outside cabling to the panel. If that cable or the panel was accidentally shorted (such as when it is being worked on) power from the battery could flow and cause damage - the diode will prevent this in cases where the battery can discharge into the panel.
It is always advisable to provide some safety protection when using batteries in these applications - even a relatively small lead-acid battery (e.g. car battery size) can provide 100's of Amps of current and cause wiring damage or even a fire.