Firewalls function by monitoring and filtering network traffic. They can be configured to block unauthorized access while allowing legitimate traffic to pass through. There are different types of firewalls, including hardware firewalls, software firewalls, and cloud firewalls. Each type has its own set of advantages and is suitable for different business environments.