"I was thinking the spray headliner glue for cars...?"
I'd suggest 3M's #77 Sprayment, which is a permanent adhesive, or their headliner spray, yes. All of those sprays are "rubber cement" but some of the cheap stuff is not permanent, or releases after time and heat. Buy a brand name. Then let it air out, once the solvent kicks off there should be no toxicity problem.
The foam itself may need to air out for a week or longer anyway, to get rid of chemicals from the manufacturing.