Keep my garage moisture free

I’ve been told by a metal building supplier that over time, the spray foam will trap moisture between it and the walls and cause the building to rust.
Not if the moisture remains outside .