Charge transfer processes in ion-matter interactions are crucial for ion beam-driven high-energy density physics, material irradiation damage, and charge state stripping in accelerator techniques. Here we generate carbon ion beams in the MeV energy range through target normal sheath acceleration (TNSA) mechanism, and measure the average charge state of 1.5–4.5 MeV carbon ion beams passing through porous C
9H
16O
8 foam with a volume density of 2 mg/cm
3. The measured average charge states are compared with the average equilibrium charge-states predicted by semi-empirical formula and rate equation. The results show that the predictions from the rate equation that fully considers the ionization, capture, excitation, and de-excitation processes are in good agreement with experimental results. The prediction from the rate equation by using gas target cross-section data underestimates the experimental data, because the target density effect caused by the solid fiber filaments in the foam-structured target increases the ionization probability through frequent collisions, reduces the electron capture probability, and thus leads to an enhancement of ion charge states. In the projectile energy range above 3 MeV, the experimental data agree with the predictions from the rate equation using solid-target cross-section data. However, a significant deviation emerges in the energy region below 3 MeV due to the fact that in this energy range, the lifetime of ion excited states is shorter than the collisional time scale. In this case, excited electrons have time to de-excite the ground state before the second collision occurs. Consequently, the target density effects are weakened, and the charge states are reduced. The experimental results agree well with predictions from the ETACHA code that considers excitation and de-excitation processes in detail. This work provides the data and references for better understanding ion-matter interactions and distinguishing various charge exchange models.