From this Apple Discussion:
This message is basically directly related to the payment method that is linked to your Apple ID. This message will appear if you have an unpaid balance on your account or the payment method itself is invalid (for any reason).
To fix this you need to provide a payment method or chose “none”. If there is a payment due or if family sharing is enabled you won’t be able to choose “none”.
How to change your payment:
From this Support article:
Go to Settings > [your name] > iTunes
& App Store.
Tap your Apple ID, then tap View
Apple ID. You might be asked to sign
Tap Payment Information, then
change or remove your information.
To remove the payment method,
select None. Get help if you don't see
None or can't select it. Learn more
about what payment methods
are available in your country or region.
Make sure that your name and billing address exactly match the information on file with your financial institution, then tap Done.
If you can't choose None when you edit your Apple ID payment information - Apple Support