You need to pay National Insurance in the UK for the first 52 weeks of working abroad if you meet all of the following conditions:
you’re working abroad temporarily
your employer has a place of business in the UK
you’re ordinarily resident in the UK
you were living in the UK immediately before starting work abroad
Your employer will deduct your National Insurance from your earnings.