Is this a general question, or a specific one because you have a sick fish?
If it's the former, you should as a rule leave the media in the main filter until it is required, or the bacteria will die off.
Then, move it over as you move the sick fish. Once you've cured your fish of whatever ailment it had, I'd boil the media and leave it out of the water a week or so to kill off anything related to the illness/parasite that might still be resident on it, before putting it back in the main tank to prepare for the next time. Or chuck it and get another sponge. You don't want to infect the main tank. Strip the tank completely too, don't leave it standing around to fester on a general basis.
This is also a handy way to have media ready for setting up a quarantine tank for new purchases (in the same tank).
If you have a sick fish right now, get that media in the main tank immediately for a day (I wouldn't just chuck it in the filter, I'd rub/wring the main and second media together to encourage cross pollenation so to speak- also ensuring the water flow goes FROM the main media TO the secondary not the other way round to also encourage migration) and the fish in the second tank with no filtration now, then on day 2 50% water change the hosptal tank and move the media over to it- the bioload should be low, and the media should be seeded at least. Keep an eye on water chemistry and fix with water changes as required.
But that's just what I'd do!