Gaps in your national insurance (NI) record can reduce the amount of contributory benefits you are entitled to, including maternity pay, employment allowance and the state pension. 

Where an individual is aware of missing years, for example, if they have been out of work, or out of the UK working abroad, they can make a voluntary payment of class 3 (or class 2 for self-employed taxpayers) to plug the gap.

Protection is available in the form of NI credits for people out of work for reasons such as childcare or caring responsibilities, illness, disability and many more.

 More...  https://www.accountingweb.co.uk/tax/hmrc-policy/how-do-you-solve-a-problem-like-ni-gaps?fbclid=IwY2xjawGMSgtleHRuA2FlbQIxMQABHbgyDehy9BaYKR41VZAGTXXg6aY5-bR9a5MzRJcaKt0sK_MLF4f18D7CMw_aem_b32NfQhYgSULdSIFPsIbBA