The adsorptive potential of melamine–formaldehyde (MF) polymer derived elastic carbon foams (CF) has been explored for the first time for the extraction of low levels of environmental pollutants from water samples. The prepared CFs are obtained from the direct carbonization under nitrogen atmosphere of MF. CFs are used as flow-through supports and are implemented for automated solid-phase extraction using the sequential injection analysis technique. In comparison to other carbon-based materials, the use of monolithic networks based on CFs showed low-pressure and good mass transfer of the analytes, enabling the efficient extraction of bisphenol A, 4-tert-octylphenol and 4-n-nonylphenol from water samples prior to their quantification using liquid chromatography. Different experimental parameters such as selection of the eluent, sample and eluent volumes, and preconcentration and elution flow rates, were evaluated. Under the selected conditions, the detection limits were between 0.02 and 0.08 μg L−1 and the relative standard deviations (RSD, 10 μg L−1) ranged from 4.1–4.8%. Batch-to-batch reproducibility for three different carbon sponges was 5.8–6.3%. The obtained preconcentration factors were between 24 and 38, using a volume of 4 mL of sample. The CFs are chemically robust and flexible, and reusable at least 50 times. Different water samples such as well water, wastewater and leachates from a solid waste treatment plant were analyzed to investigate the capability of CFs for real sample analysis.