NIM33215 | Voluntary National Insurance contributions for periods abroad – Persons coming into the UK
From HM Revenue & Customs · National Insurance Manual
A person in the UK would normally pay voluntary NICs to maintain their National Insurance record for benefit purposes if they are not liable to pay NICs or they have a shortfall in their record which means a tax year does not count for benefit purposes.
There are prescribed conditions as to residence and presence within SSCBA 1992 on whether a person is liable or entitled to pay NICs. Those limitations are prescribed by section 1(6) of SSCBA and contained within Regulation 145(1) of SSCR 2001.