You can fill it with more foam, or, if it is in an inconspicuous spot, fill it with aquarium filter floss.

Spray foam normally needs a minimum of 24 hours to cure. I normally wait 48 hours or more for it to cure. Disturbing it before it fully cures causes shrinkage, as you found out.