It is believed that people take birth on this earth to attain moksha (which is the last goal) of a jivatma, so if a person who has good karma has to live very less years (or suffer) on this earth compared to a person who has bad karma ?
Karma is something which a person has to go through no matter it is good or bad. It is said that the moment one's Karma is over for their current life, the person dies.
The Upanishads state that if you hold Karma, good or bad, you have to take birth to finish it off. The Moksha is attained only when you go beyond Karma cycle. Then the person is also removed from birth-death cycle.
In BhagavadGita Krishna says:
After attaining Me, the great souls, who are yogis in devotion, never return to this temporary world, which is full of miseries, because they have attained the highest perfection.(Bg 8.15)
From the highest planet in the material world down to the lowest, all are places of misery wherein repeated birth and death take place. But one who attains to My abode, O son of Kunti, never takes birth again. (Bg 8.16)