Invisalign aligners should be worn for about 22 hours a day. The only times that you should not be wearing your aligners are when you are either eating or drinking.
Though you are still allowed to drink cool water while wearing Invisalign, sugary beverages are prohibited. 22 hours a day means yes, you do need to wear it while sleeping, Failure to comply with total wearing time may impact overall treatment length.
To learn more about Invisalign clear aligners: https://diamondbraces.com/invisalign/