Depends on what you mean by changing the filter.
The filter MEDIA trap different things from the water, and you can add chemical media that can remove or add things to the water.
Mechanical media trap objects from leaves on down to dust, specifically including fish waste and fallen food. When these materials decompose they can produce ammonia, if they had any protein in them. Cleaning the filter media, rinsing this stuff off frequently will remove these decomposing materials from the tank system, so reduce the amount of ammonia produced. (See Biological filtration)
Biological filtration is usually thought of as the control of nitrogen, including ammonia, nitrite and nitrate. Mostly we think of it as a group of bacteria that remove ammonia (from any source, but most often fishes' gills and decomposing matter) and turn the ammonia into nitrite, then a second group that remove nitrite and turn it into nitrate.
If there is a lot of ammonia (high fish load, lots of fish food) then the net result is high nitrate. Keeping the media clean where these bacteria live (gently rinsing in water removed from the aquarium) will keep the bacteria healthy and thriving, and keep the channels open for the optimum water flow. Throwing away this sort of media will cause an ammonia spike, usually followed by a nitrite spike because the bacteria have been thrown away, but the ammonia sources keep on producing ammonia. As the bacteria recover their population the ammonia removing bacteria grow faster, the nitrite removing bacteria grow slower.
Chemical media used to remove things from the water:
Activated Carbon, Purigen, Zeolite and several *zorb sorts of media chemically bind certain things removing them from the water column. When these media are full you can remove them.
Some of these media can be rejuvenated, the toxins get removed, and the media reused. If you leave these in the filter some may release the stuff they had trapped, and trap something else.
Some cannot be rejuvenated by any process available in the home. Leaving this sort in the filter does not cause the things they trapped to be released.
Chemical media used to add things to the water:
Coral sand, oyster shell grit and related materials add minerals to the water. Peat moss and other organic matter add organic acids to the water. When you remove them from the filter they obviously quit adding stuff to the water.