The carbon in the filter removes contaminants and chemicals from the water.
Therefore, if it is left it in whilst treating the tank for something, it will remove the treatment and whatever you were trying to treat will continue to be a problem.
Once the course of treatment has been completed, carry out a 10% water change and replace your carbon filter.