Providing that you have not attempted to jailbreak your device - or have bypassed protections by side-loading third-Apps (if you don’t know what this is, then don’t worry about it), then it is highly unlikely that your device will actually have been infected with a virus or other malware.
Most alerts that you see are pop-up messages from websites - these being designed to scare the unwary into giving away sensitive information - or to fool you into doing something that you shouldn’t. Simply close the Safari window - and as already suggested by ProustGiulio, it will do no harm to clear your website history and cookies:
Clear the history and cookies from Safari on your iPhone, iPad, or iPod touch - Apple Support
Due to the system architecture of iOS/iPadOS, unless jailbroken, your iPad is not susceptible to traditional malware infection per-se. However, as with all computer systems, there are still vulnerabilities and exploits to which you remain at risk.
Whilst acknowledging that there are no “AntiVirus” products for iOS/iPadOS (any that products that claim such functionality should be avoided), there are several ways to reduce the likelihood of encountering issues in the future.
Browser-based attacks can largely be mitigated by installing a good, trusted, Content and Ad-blocking product. One of the very best and most respected within the Apple App Store - designed for iPad, iPhone and Mac - is 1Blocker for Safari.
https://apps.apple.com/gb/app/1blocker-for-safari/id1365531024
1Blocker is highly configurable - and crucially does not rely upon an external proxy-service of dubious provenance. All processing takes place on your device - and contrary to expectations, Safari will run faster and more efficiently.
Unwanted content is not simply filtered after download (a technique used by basic/inferior products), but instead undesirable embedded content blocked form download. A further benefit on metered services, such as cellular connections where you data may be capped or chargeable, this not only improves speed but also saves you money.
When using a good quality Content blocker, a high proportion of otherwise inescapable risk when using your Safari browser, or linking to external sources from email, is effectively mitigated before it even reaches you.
There are additional protections that can enhance protection, such as using one of the better Recursive DNS Services in preference to automatic settings that will use the DNS services provided by your ISP. These DNS settings can either be set on a per-device basis in Settings, or can be set-up on your home Router. I recommend using one of the following services, for which IPv4 and IPv6 server address are included here:
Quad9 (recommended)
9.9.9.9
149.112.112.112
2620:fe::fe
2620:fe::9
OpenDNS
208.67.222.222
208.67.220.220
2620:0:ccc::2
2620:0:ccd::2
Cloudflare+APNIC
1.1.1.1
1.0.0.1
2606:4700:4700::1111
2606:4700:4700::1001
Use of the above DNS services will help to shield you from “known bad” websites and URLs - and when used alongside 1Blocker, provides defense in depth.
I hope this reassurance and guidance proves to be helpful in resolving any issues with suspect malware and malicious websites.