I framed a 14' x 16' deck on piers between 3-4' from grade as the base for an enclosed, heated Sunroom. I applied 4X8 sheets of 1/2" PT to the underside. Then I used 1 1/2" Styrofoam between the bays and on the rim joists (https://www.finehomebuilding.com/project-guides/insulation/air-sealed-and-on-piers), followed by R19 in the remaining cavity. It was threatening to rain (2-3") before I was able to install the subfloor, so I covered it with a tarp. Unfortunately, there was some rain that got in there anyway. Replacing the fiberglass is not a big deal, but I worry about the moisture that got underneath the foam. Will it dry out by itself, or do I need to remove the foam and give it time to dry out? Thanks.
Moisture will dry through cracks and through the PT over time.
After the short period of rain fall that you describe, your concern would be water trapped between a moisture barrier (foam insulation) and wood, not an increase of moisture content the lumber itself. PT can withstand high moisture for prolonged periods of time (e.g. seasonal exposure to rain)
If you used EPS styrofoam (encapsulated kernel type), it will allow drying out faster than if you used XPS (the almost solid looking type).
How long the flooring system takes to dry out depends on the surrounding humidity and temperature while drying. In the meantime it very likely will not cause rot. Keep it protected from rain, and let it air.
If the lumber is below 75% in the critical areas you should be good. Note this is humidity around the wood and the moisture content (MC) of PT wood. (For non-PT you aim for 20% or so; regular framing lumber take over a year to dry after installation.)
Make sure you don't seal the PT sheets at the bottom (underneath the deck), and don't put in flooring on top until it has had a few days time to dry out. If you can, delay finishing the floor, and measure the humidity of the closed room before laying flooring: with windows closed it should be at or below the outside humidity. Even better if you can hit a few sunny days with open windows before closing the floor.
Also, you can improve airflow if you temporarily open (remove or loosen) some or all of the fasteners (screws?) you used to attach the PT sheets.
In addition you could lift up corners of the foam and hold it up with some scrap lumber, if you can reach into the cavity. Any "water to the touch" should dry out rapidly this way.
You could also check with a Moisture Meter to ensure the moisture is dropping over time. Different attachments allow you to probe specific spots or general areas.
Eventually, all the moisture will escape due to gaps between your sheathing and framing. However, I'd pull a piece or two of the foam and see what it looks like. If there are puddles, definitely pull the rest of the foam to let it dry. If it's just a bit damp, you're probably just fine.
To be honest, if you've got a nice sunny day, a couple of hours without the foam in there will probably dry everything out and you'll be able to get right back to work. You might even be able to air dry the fiberglass batts and reuse them instead of replacing them, though that would be good fodder for a whole new question. (Will they still be usable if dried and how to determine if they are dry enough?)
Of course, local humidity levels will determine just how fast it actually dries whether you pull the foam or not