Looks like 2006 and earlier it wasn't required to go to the exterior.
From
https://inspectapedia.com/ventilation/Bathroom_Ventilation.php
2006 ICC Ventilation Code, Chapter 4, Ventilation
The U.S. state of Virginia adopted the ICC model ventilation code that we cite here.
Required Bathroom vent fan ventilation rate in CFM
This ventilation code specifies a bathroom exhaust airflow rate for toilet rooms and bathrooms (not served by a window of adequate size) of
25 or 50 cfm/ft for hotels, motels, resorts and dormitories, and a slightly more modest 20 / 50 cfm for private dwellings.
Rates are per room unless otherwise indicated.
The higher rate shall be provided where the exhaust system is designed to operate intermittently.
The lower rate shall be permitted where the exhaust system is designed to operate continuously during normal hours of use. - [Table 403.3, Minimum Ventilation Rates]
This model ventilation code also specifies that the ventilation system
Exhaust openings shall have a minimum and maximum size in louvers, grilles and screens, measured in any direction of not less than 1/4" and not more than 1/2"
Intake openings in residential occupancies shall be not less than 1/4" and not more than 1/2"
Intake openings in other than residential occupancies shall be not less than 1/4" and not more than 1" - [Table 401.5, Opening Sizes in Louvers, Grilles and Screens Protecting Outdoor Exhaust and Air Intake Openings]
ICC & Virginia Mechanical Code, Section 401, Ventilation, 2006 [PDF] retrieved 2016/09/12, original source:
http://www2.iccsafe.org/states/virginia/Mechanical/PDFs/Chapter 4_Ventilation.pdf
2015, 2009 & 2006 IRC Bathroom Ventilation Code Section R303.3
Where no window: 20 cfm continuous, 50 cfm intermittent, vent to building exterior
The 2006 (or later) International Residential Code IRC R303.3 Bathroom Ventilation - requires that
when natural ventilation requirements (3 sq ft of windows 50% operable) can't be met,
the bath should be vented by either a 20 cfm continuous vent fan or a 50 cfm vent fan that is intermittent (or switched).
Exhausting of the bath vent fan must indeed be to the building exterior.
Exhaust Air from toilet rooms and bathrooms shall not discharge into attic, crawl space or other areas inside building.
See BATHROOM VENT DUCT TERMINATION for details about how to terminate the bath exhaust vent duct.