Drying the pillow is vital after washing. But don’t use any machine instead of air dry on a flat. But it has to be ventilated surface that stays away from direct heat and sunlight. The clothes dryer and any high heat tools are responsible for damaging the foam.  You can just use a portable fan to circulate air for quick drying. Don't try to wring out our memory foam to remove excess water. Just leave it on any open stand to remove the excess water easily. Then wait for drying from inside to outside. And based on the foam thickness of the memory foam, it may take more than 24 hours to dry fully.