It tracks your heart rate and movement through the night. If you want a fairly accurate reading, you do need to wear it all night.
If you don't wear it at night, the app will ask you the next day if you were sleeping from the time you took it off to the time you put it back on.