A firewall is a system you use to prevent unauthorized access to or from a private network. You can implement a firewall in the form of software, hardware, or a combination of both. All content entering or leaving your local network must pass through the firewall, which reviews it and screens out hackers, viruses and worms. Windows 7, Windows Vista, and Windows XP SP2 or higher have a firewall built-in and is turned on by default.
See http://windows.microsoft.com/en-us/windows7/Understanding-Windows-Firewall-settings to learn more about Windows firewalls.
See also, How do I protect against viruses?