Is it possible for an iPad to get a virus? I was using Safari on my iPad and suddenly a pop up message saying "your device has a virus" appeared. I just clicked okay because that was the only option and then it redirected me to youradexchange.com. Is it possible for my iPad to get a virus?

I'm using iPad mini Retina with iOS 7 and it is not jailbroken.
Yes, you can get malware on an iPad if you install apps from untrusted sources (Anything outside of the App Store).

However, you cannot get a virus from simply going to a website, as the process of installing an app from a third-party requires your interaction and can't be done in the background.