The song had nothing to do with Y2K, which wasn't an imagined crisis until a couple of years before the event. Prince was referring to the perception that there would be an enormous "best-of-imaginable" parties associated with New Year's Eve in 1999, because it was such a momentous event: the turning of the century/millennium count (even though purists are right to point out that the next century/millennium would not start until 2001). The simple turning of the digits was anticipated by most people as a thrilling, rare once-in a lifetime event - that was not even enjoyed during most lifetimes. An enormous party was expected and imagined.
Unfortunately I have to disagree with the usually magnificent /u/itsallfolklore: it's pretty clear from contemporary reviews of the album 1999 from 1982-1983 that people very much interpreted the song as being about dancing in the face of the apocalypse. Certainly Prince was not singing about fear of The Y2K Bug (the idea that older computers had not been designed with the change of millennium in mind, and would default back to 1900 rather than tick forward to 2000); this was not a popular media issue until the mid-to-late 1990s.
But, well, the mathematical fact of it being close to two millennia since the birth of Jesus of Nazareth made some people think that we were reaching The End Times, when Jesus would return. The Cold War between the USA and the Soviet Union, of course, also led many to think that nuclear warfare would be one of the things that puts us in apocalypse territory ("Mommy, why's everybody got the bomb?" as Prince has a childish voice ask). This dread reached something of a fever pitch in the early 1980s, thanks to Ronald Reagan's public hawkishness; the 1984 movie Red Dawn is usually trotted out as an example.
Where contemporary reviews of the album 1999 mention the lyrics of the title track, they're almost unanimous in mentioning the apocalyptic aspects of the song.
One 'Betty Page' (perhaps not her real name?) in Record Mirror said of it that:
this is his theory: it's 1999, the bomb's about to drop, so we might as well drop 'em and party down.
Richard Riegel in Creem argued that:
Title cut of 1999's about gettin' down one more time, before Thuh Bomb falls, pure existential party stuff, and yet Prince is pushing for nuke disarmament in his own subtle-squeak way, implication is that his orgasms are apocalyptic enough already, he don't need the Bomb threat spicing 'em up.
Barney Hoskyns in the NME in 1983:
It's not that Prince can't do the apocalypso anymore. 1999 the song and single is like 'Party Up' phased through the Todd Rundgren of 'International Feel'.
Michael Hill in Rolling Stone's 1982 review of the 1999 album:
On the title track of 1999, which opens this two-LP set of artfully arranged synthesizer pop, Prince ponders no less than the future of the entire planet, shaking his booty disapprovingly at the threat of nuclear annihilation. Although that one exuberant dance-along raises more big questions than Prince can answer on the other three and a half sides combined, the entire enterprise is charged with his unflagging will to survive — and a feisty determination to eat, drink and be merry, for tomorrow, given the daily news, we may die.
Prince had already made musical commentary along these lines previously; on the song 'Ronnie Talk To Russia', from his album Controversy, released in 1981, he sang about how "Ronnie talk to Russia before it's too late/ Before they blow up the world" (Ronnie transparently being Reagan, of course). So yes, the Y2K bug wasn't a concern in 1982, but nuclear war certainly was.