I Googled what causes the smell in memory foam and found these answers.
# Memory foam mattresses smell
"This can be true especially with a new mattress out of the bag. Visco Elastic Memory foam does have a period of off gassing. This odor in most cases dissipates quickly in usually days or weeks. Simply airing out will speed up the process. There are extreme cases where a customer’s sensitivity requires a mattress exchange. Most people expect new products just like a new car to have an odor they are not used too.
# Memory foam is flammable
It is a polyurethane product which can be flammable. Laws have been put into place requiring all USA beds, including memory foam mattresses to be resistant to open flame. Concerns have been raised that a high level of the fire retardants such as PBDE, are commonly used in memory foam. (Read about the new Fire Law)
# Memory foam creates health problems
Well, this is a tough one. The jury still seems to be out on this one. With the emergence of all natural and organic mattresses (competition) these issues have really been pushed to the forefront concerning products like memory foam mattresses and even other related products. It is a polyurethane foam, a synthetic petroleum based product. We will just suggest this tidbit of information, imagine the repercussions if it is found to be true. Right now there are endless uses for these materials; everything from sofa cushions to car seats. We will simply let the foam industry to defend their use of certain chemicals and how they affect the human body. There are now alternative organic and all natural mattresses on the market to choose from if you are still concerned about possible side affects from synthetic products such as memory foam."
Another site said to be sure your foam was made in the USA and not made elsewhere shipped here for assembly and then marked made in the US. Foam made here has to not contain certain things.