No, the photovoltaic system will work and produce power regardless, but having a battery offers many benefits. Batteries allow you to take full advantage of all the solar energy produced during the day and make your home or business partially or entirely energy independent.
In photovoltaic systems without a battery, when the panels produce more power than necessary, there are two ways for the system to handle the situation - sell the excess to the grid provider or curb production to match the demand if selling is impossible. Curbing the power output is undesirable - it means the system is underutilised.
On the other hand, when production is insufficient to meet demand, for example, in cloudy weather or at night, there is no choice but to purchase electricity from the grid provider. A battery acts as storage for excess energy and supplements power when needed and as a whole house UPS in the event of an outage.