You could say either "life" or "lives," but I take them to have different meanings.
The ranch workers were destined to live a horrible life, for they were haunted by loneliness.
In this sentence, I would assume that the loneliness the ranch workers were haunted by is a result of their being ranch workers. Because they are all doing the same thing and lonely for the same reason, they have a horrible life and not lives because there is little separating the individual ranch workers. Metaphorically, they are all living the same life.
The ranch workers were destined to live horrible lives, for they were haunted by loneliness.
I would interpret this to mean that each of the ranch workers was lonely, but that they were not necessarily lonely for the same reason (i.e. because they are ranch workers). Unlike in the above sentence, they are not (metaphorically) living the same life.
I didn't find it particularly easy to articulate that, so if it could be clearer please let me know.
I think context plays a large part in interpreting these sorts of sentences, and even then some sentences may sound nonsensical.
All the people in the audience raised their hands.
We all know that hand-raising usually involves raising only one hand, and we can safely assume that everyone in the audience has at least one hand, so it's clear to the reader that the audience members are individually raising a hand.
In other situations, it may be best to rewrite the sentence. I'm shamelessly stealing this example from EL&U:
Corporations may not have a conscience, but they do have PR departments.
Corporations may not have consciences, but they do have PR departments.
Corporations may not have a conscience, but they do have a PR department.
Which of these is correct? Definitely not the third one (which states that all corporations have a single lack of conscience and a single PR department), and while the the second one is more favourable than the first, these sentences could be rewritten into an unambiguous form:
A corporation may not have a conscience, but it does have a PR department.
Here we run into some other difficulty. Your sentence isn't as simple as this one, mostly because you're using the definite article. You could say:
The ranch workers were each destined to live a horrible life, for they were haunted by loneliness.
By using each, the sentence now refers to the ranch workers individually and separately, so using the singular is unambiguous.