Originally Posted by hellosailor
"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.
That is the biggest complaint I have read about the less expensive memory foam mattress it that since they come vacuum packed they give off a lot of odor at first. I think it is more that it is packed in plastic, rather than the loose covering of the more expensive ones as they do not ship compressed. I think a few days or perhaps a week, and they will be OK.
I would check a good craft store (or even better would be an upholstery shop) and see what they recommend, you don't want to wind up melting the foam!