There doesn't really have to be one.
Some aircraft do not have a firewall.
But it does provide a number of functions on most that do. For instance on a great many planes the firewall acts as a structural member to "beef up" a hard point that other structures are then affixed to.
This does a number of things, firstly it provides for a starting point (and terminator) for much of the most severe vibrations to arise in a plane. This allows for easier compilation of the wave forms in predicting flutter probability in the first few steps of designing the aircraft's airframe.
If there is a "bell" incorporated into the design it can even REDUCE these vibrations, by dampening them through conversion to audible and inaudible "noise". Care should of course be taken to make darn sure the frequencies of the bell are not harmful, but that SHOULD go without saying...
Firewalls of course also keep fires from spreading if there is a PRAYER of doing so (aircraft fires are typically VERY HOT and if action is not immediately taken to quench these no fire wall is likely to last long enough to matter...).
Firewalls are usually heavy too. This allows some ballast to be placed where the designer WANTS IT. This often shortens the lever the prop is working against, sometimes reducing vibration periods from the engine compartment and to some degree. This also decreases aerodynamic loads in SOME DESIGNS (both drag and structural).
A good way to picture how all this works is to get the plans of an F4F2 and ask a computer to analyze the design WITHOUT a firewall.