The technical name for the material used within memory foam mattresses is visco-elastic polyurethane foam.
This type of foam was initially developed for use in the NASA space program many years ago to help astronauts with g-force during take-off. Memory foam was not initially released into the open market, however it did find its way into hospitals to treat patients who suffered from bed pressure sores.
Memory foam mattresses distribute bodyweight more evenly than traditional mattresses, which reduces pressure build-up that can lead to neck, back and joint discomfort developing during sleep. Once the many benefits of memory foam mattresses were realised, manufacturers started to introduce products into the mainstream domestic bed and mattress market.