In addition to the possibility that bmdixon raised of malware, I'd like to add that it's entirely possible that it's not even necessarily malware, but rather instead social engineering type adware trying to get you to install malware or buy something useless. You often see those types of pop up messages on websites for Windows users, and this sounds very similar to me. Without more info, like which app popped up this message or a screenshot, this would be my guess as to what's happening on your phone.
Many of these types of adware can be blocked using system-level adblockers such as AdAway, which can be installed from repositories such as F-Droid if you have root. (such blockers are no longer available on Google Play as they undermine Google's primary business model) Or of course by not installing apps that rely on ad revenue in begin with :)