carbon adsorbs organic compounds from the water. this includes odors (primarily phenols), proteins, amino acids, pheromones and other metabolic byproducts which are continuously being exhausted into the aquarium water by the fish or other aquatic animals.
the reason you need to remove carbon from the water when medicating is that these medications are organic and will be removed from the water before they get an opportunity to act on the disease you're treating.
here's some info on carbon which might give you pause, as to whether to use it at all. there are many types of carbon sold for aquarium use but VERY FEW of these are actually capable of adsorption in water. only HIGH QUALITY ACTIVATED GRANULAR carbon which has been degassed in an oxygen oven at temperatures close to 2,000 degrees Fahrenheit is functional --- anything else is worthless. i can recommend Marineland activated granular carbon in this regard though there may be others. degassing enlarges the apparent surface area of each carbon granule, thus greatly increasing the adsorptive capacity. prepackaged cartridges containing carbon typically contain poor quality carbon and if quality carbon is used, only 20 percent or less of the recommended amounts is present. you can slit open the cartridge and fill them with more GAC but many pad filter types simply will not hold that much. thus, the carbon in the vast majority of filter pads on the market simply are not functioning.
a weekly water change schedule taylored to your bioload will work equally well however and is certainly less expensive.