Firewalls are a barrier to the dangers that exist on the internet and as we all know, there are a lot of these dangers. Your network is constantly being probed, firstly for an entry point and then if one is found, to exploit this entry point for weaknesses.
There are 65535 possible entry points and 65535 possible exit points from your network – browsing the internet (HTTP) is just 1. Others you may have seen include HTTPS and FTP.
A properly configured firewall can restrict these exit points to only ones that you need (e.g. HTTP and HTTPS) and more importantly can block all entry points so that anything from outside your network is prevented from coming in uninvited. By blocking these entry points, viruses and malware cannot even start the process of finding weaknesses.