Short answer: yes - properly installed and fully cured spray foam is a safe, inert, widely-used building material. The nuance is in the words 'properly installed and fully cured,' which is exactly why a certified installer matters.
During installation and curing
Spray foam is a reactive, two-part chemical applied wet. During spraying and a short curing window, the area needs proper ventilation and the space kept clear per the manufacturer's re-occupancy time. A trained installer manages ventilation, ratios and temperatures so the foam cures correctly.
Once cured
A correctly cured foam is inert and stable - it's why it's used in millions of homes. In occupied space it's finished with a code-required thermal barrier for fire safety.
Where 'safe' can go wrong
Safety problems trace to bad installs: off-ratio mixing, wrong temperatures, or inadequate ventilation - the things a CUFCA-certified installer working to CAN/ULC-S705 is trained to avoid. That's the whole argument for vetting the installer, not just the product.
More on certifications and off-gassing. Get a quote from a vetted installer.