"They need to rest."
Translation:Їм треба відпочивати.
It depends on the context, which is missing in the sentence.
Їм треба відпочити зараз -- They need to have a rest now, it's time for them to take a rest.
Їм треба відпочивати кожну годину -- They need to take a rest every hour. This form of the verb should be used when saying how often they need to rest.