Unless you are disabled, you cannot collect Social Security benefits based on your earnings until you reach the age of 62.
In any case, your benefits are calculated based on your highest earnings for 35 years. Zero earnings years will not reduce your benefits if you have worked for at least 35 years.
For each of the 35 years it uses, Social Security will take your earnings (up to the contribution limit for that year, e.g. for 2010 the limit was $106,800) and multiply it by an index factor that depends on the actual year (e.g. for 2010 the index factor is 1 but for 1970 the index factor is 6.68176). The further back in time, the multiplier gets larger. This is an attempt by Social Security to make each year worth about the same insofar as adding to your benefits.
The sum of the 35 years of earnings, with each multiplied by the appropriate index, will yield what is called your AIME (average indexed monthly earnings). Your actual benefit is based on this number but also depends on your age.
Note that all of this information is available on the Social Security website and is also contained in a publication entitled "Guide to Social Security" published by Mercer (see their website: www.imercer.com/socialsecurity).
The main point is that zero earnings years will not impact the amount of your benefits if you have 35 years with non-zero earnings.