If you where visiting a web and some pop-up said you have a virus and then invites you to install MacKeeper or whatever, just ignore.
If you were using a well known antivirus just allow it to disinfectate your system, in case cant disinfect or requires registration to allow disinfection, then I suggest you before purchase an anti-virus to check the publisher's background, there are solid publishers as McCaffe and not so recommendable as MacKeeper (avoid at all cost).
In extreme circumstances (trojan/hi-jack) re-install mac os and its apps (ONLY SIGNED/APP STORE).