It is not recommended to wear compression socks while sleeping as this can lead to discomfort and decreased blood flow. They are meant to be worn during activities and should be removed for extended periods of rest.