Typically, TED hose are worn for approximately 6 weeks post-cardiac surgery. They can be taken off at nighttime, rinsed under warm water, and set out to dry over the bath tub. They are put back on when the patient wakes up in the morning. I am a cardiac nurse that takes care of open-heart patients regularly.
Yup, due to gravity being leg of an issue while asleep
... it's usually fine not to wear them while sleeping... there this also the option of IPC (intermittent pneumatic compression) while sleeping instead of compression stalkings.