They are seen as lizard creatures, then they are stunned with a phaser, brought back aboard Voyager, and seen next in human form back in sick bay. How did the Doctor do this?
The Doctor used anti-proton therapy to erase all traces of the mutated DNA from their system.
EMH: I believe the answer lies in forcing his DNA to revert to its original coding. Once that occurs, his body should return to its former state.
CHAKOTAY: How do we do that?
EMH: We destroy all of the new DNA in his body. His cells will have to use the original coding as a blueprint. But the only way to destroy the mutant DNA is with highly focused antiproton radiation.
EMH: I've eradicated all traces of the mutant DNA from your system and restored your original genome. Congratulations. You're human again.
Unfortunately the same treatment won't erase all memory of this episode from my brain.
In universe, from Memory Alpha
Paris and Janeway are reverted back to their Human selves using The Doctor's anti-proton treatments, although Paris is extremely embarrassed about having mated with the captain.
ie it was magic.
Out of universe, it was a sordid assault on rational thinking by a writing staff who should have known better1. From Memory Alpha again:
Brannon Braga named this episode as the one installment from the entirety of Voyager that he would "just as soon forget" and remarked, "That's a real low point [....] It really backfired on me. It was poorly executed by me."
1 And, to be fair, they did do much better for the rest of Voyager's seven seasons.