Firewalls monitor and control network traffic based on predetermined security rules. They act as a barrier between the internal network and external threats, blocking malicious traffic and preventing unauthorized access. Firewalls also help in detecting suspicious activities and mitigating potential attacks.