This is phishing. There is no virus on your computer. The problem comes either from a website you visited, from a Safari extension or from malware.
As stedman1 said, quitting Safari and launching it from the dock while holding the shift key will likely solve the problem, because it will close all your tabs and temporarily disable your Safari extensions.
If the problem comes back when you launch Safari normally (and visit DIFFERENT websites), go into Safari preferences and disable your extensions one by one to see which one is causing the problem.
If stedman1's trick doesn't work, go in Safari preferences, in General, and make sure your startpage is a known-good website. If it isn't already, change it, quit Safari, and launch it from the dock while holding shift.
If this still doesn't work, I advise you to run MalwareBytes. You can get it here for free : https://www.malwarebytes.org/antimalware/mac/
If this still doesn't work, which would greatly surprise me, call Apple directly. They'll be happy to help you with that. Get their number here : Contact Apple for support and service - Apple Support