Your work history over the recent (last 15 years) is relevant if you are over the age of 50. To prove disability prior to age 50, you must prove you cannot perform any job that exists in the national economy. After 50, the jobs must have similar skill sets as your past work. After age 55, the skills and job duties must be essentially the same in another job you can do with your limitations in order for SS to find you are not disabled.
Your work history and earnings records are also used to determine other things. They determine how much you will receive in disability benefits. Your work history and earnings also are used by the Judge to help weigh your credibility. People who have consistent work history with good earnings are often given more credibility when they claim pain is limiting their ability to work.
The opposite is also true. If you haven’t held a job consistently and you’ve never made very high earnings, it will be harder to convince the Judge that you are now unable to work as opposed to choosing not to work. Many factors are considered by SS when determining credibility; this is just one of them that many people do not realize.