Yes, its a scam. Apple will never contact you to inform you of a potentially compromised device, account or device lockout.
See >>> Recognize and avoid phishing messages, phony support calls, and other scams - Apple Support
Alerts of this nature are designed to scare the unwary into giving away sensitive information - or to fool you into doing something that you shouldn’t - usually to defraud you financially.
Don’t respond to, or engage with, the message. Certainly do not, under any circumstances, attempt to contact anyone using the contact details that may have been provided. Simply close the browser or pop-up window - or if received via Mail or other messaging platform, delete the message - ensuring that you have also deleted from the associated Trash/Bin folder.
As a precautionary measure, you might also perform a forced-restart of your iPad - as this will ensure that a memory resident threat, if present, is purged:
Force restart iPad (models with Face ID or with Touch ID in the top button)
If your iPad doesn’t have the Home button, do the following:
- Press and quickly release the volume button nearest to the top button.
- Press and quickly release the volume button farthest from the top button.
- Press and hold the top button.
- When the Apple logo appears, release the top button.
Force restart iPad (models with the Home button)
Press and hold the top button and the Home button at the same time. When the Apple logo appears, release both buttons.
If you suspect that your AppleID has been compromised, follow the advice outlined here:
If you think your Apple ID has been compromised - Apple Support