You have to go through the full course of treatment of at least three to four rounds of ivermectin every 10-14 days (injections, oral or spot on; injections being the most effective before oral and then spot on) for both of them.
Once a piggy has had mites, eggs that somehow survive in its skin can always make a comeback at times when it is stressed or the immune system is lowered from illness. There is no way of preventing mites, really, and any skin treatments/baths won't do anything. You can do a preventative once a month treatment, but it is not fool proof by any means. Personally, I prefer to treat as soon as they turn up.
PS: Once you have got mites, you need to treat all piggies living together.