Can I apply to graduate school twice? I'm currently a second year undergraduate student in mathematics and I'll have finished all my degree requirements two years early, but I'm at an absolutely great department so I don't want to graduate ASAP because I have a lot of opportunities here.

However, out of curiosity, I want to know if in a year or so if I could apply to graduate school and see if I can get in, and if I do, go, since I will have the option to graduate, or otherwise try again the year after. Is this frowned upon? Especially if I'll be applying to some of the same places twice? I'll probably be taking prelim courses anyway, so the course load isn't something I'd be missing out on, but the department is.
If I interpreted your question correctly, you're asking if you can apply for graduate school one year, and, if rejected, re-apply the following year. Unless there are some field-specific norms that I am unaware of, the answer is almost definitely yes. Of course, for you to stand a chance of not being rejected a second time, your application should be significantly improved. In your case, that seems likely, as you'll have had an extra year of schooling, possibly stronger references, perhaps some research experience. Good luck in any case!