Should "life" be plural or singular in the sentences below?
"life" as a word is singular. You are asking, should the singular or the plural be used here.
"Life" refers to "the people" and there are many, so "life" should be plural, right?
This is a thorny one, because what is formally correct, and what you will hear far more often in conversation, and even in news reports on TV, are two different things. Other contributors may disagree with me, but I'll put in my tuppence worth.
Firstly, you are absolutely correct. "Lives" should be used in all of those sentences. If you stick to your guns and use this correct grammar, it will in no way stand out that you are being 'oh so correct' and pedantic. (Though it may well 'register' with a teacher of English, and with anybody who loves the English language, and would suggest to them that you are an educated person!)
"The people who have been in this country their whole life..."
You will often hear this in conversation. It is as if the speaker is using the plural "people" but actually in his mind thinking, "Every person..." They follow through automatically with the correct plural personal pronoun, and then use "life" as if referring back to "every person". The same holds true for your other sentence:
The people who have been in this country all their life.
Imagine this conversation round the dinner table:
He: "You ask anybody who's lived in this country all their life, and they'll tell you how much things have changed for the worse since they were children."
She: "Well, the people I talk to say their quality of life has improved immensely."
He: "Yes, but how old are they? People who've lived their whole life here and and in the sixties and seventies wouldn't agree with you."
The first speaker correctly uses the singular "life", referring to the singular "anybody".
The second speaker just happens to introduce the word "people'.
The first speaker picks up and uses "people" as he now continues, but, just as I mentioned above, will often use the singular "life" as if still talking about "anybody".