I happened to read the following sentence in ‘Poached’ by Stuart Gibbs, which deals with coalas. They(Coalas) rest sixteen to eighteen hours a day and spend most of that unconscious. But I wonder whether the word ‘that’ is grammatically correct, for I think that ‘most of them(the resting hours)’ is correct. Would you grammarians teach me whether it is grammatically correct or not?
Yes, it's fine.
They spend most of that i.e. time devoted to resting unconscious.
Those hours allocated to resting may be understood by the speaker as a contiguous stretch or span, hence that rather than them.
That is not to say that one could not write "them":
They spend most of them i.e. those hours devoted to resting unconscious.
Both are grammatical.