Don't use any kind of "anti-virus" or "anti-malware" product on a Mac. There is never a need for it, and relying on it for protection makes you more vulnerable to attack, not less.
Your problem is most likely not caused by malware. It's a Web scam that only affects the browser, and only temporarily. There are several ways to recover.
1. If you're running Safari 9.1 or later, just close the window or tab. Then go to Step 6.
2. If you're running an older version of Safari, the easiest thing to do is to force quit the browser. Relaunch it by holding down the shift key and clicking its icon in the Dock, the LaunchPad, or the Applications folder.
You will lose the state of other open tabs and windows. Either Step 3, Step 4, or Step 5 may enable you to keep that state information. If those steps don't work, fall back to Step 2.
3. If there is a checkbox in the popup marked
Don't show more alerts from this web page
check it, then close the popup.
4. Press the key combination command-W to close the tab or window. A huge box will pop up. Press the return key and both the box and the page may close. If that doesn't happen, press and hold command-W. You may hear repeating alert sounds. While holding the keys, click the OK button in the popup. A different popup may appear, which you can cancel out of as usual.
5. From the Safari menu bar, select
Safari ▹ Preferences... ▹ Security
and uncheck the box marked Enable JavaScript.
6. After closing the malicious page, select from the menu bar
Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
to get rid of any cookies or other data left by the server. Open the Downloads folder and delete anything you don't recognize.