When you're looking to buy a mattress, memory foam and latex are two of the most popular options. Depending on your personal preference of hard vs. soft, or materials best used, your choice really depends on what matters most to you.
Memory foam is a type of man-made foam created mostly from polyurethane. When you apply pressure to memory foam, it contours around that pressure. In other words, when you lay on a memory foam mattress, it will adapt to the shape of your body. Because they are constructed from a variety of other materials in addition to the polyurethane, memory foam mattresses come in a wide variety of firmness and densities, and can also contain gels to keep the material cool.
It's great for sleepers who like the extra deep pressure, or those who sleep on their sides. The downside to memory foam is that it retains heat, which means sometimes people who sleep on it get overheated, though cooling gels can help this.
Latex is a natural material made from the rubber tree, though latex can also be created synthetically, and mattresses are available in both varieties. Latex is more elastic and has more of a bounce than memory foam does. Latex also has a lighter, cooler feel, and responds quickly to changes in pressure. That means, if you move around a lot during the night, latex will adapt more quickly to your new position. A natural latex mattress is great for people who don't want synthetic materials in their bedding, or want a mattress that is hypoallergenic.
In the mattress world, both memory foam and latex have their benefits, though they each offer a unique feel.