Efficient extractions of trace antibiotic residues in the environment are a key factor for accurate quantification of the residues. A new nanoporous material, namely, magnetically covalent organic polymer (MCOP, Fe3O4@SiO2-NH2-COP) was synthesized in this work and was used for magnetic solid-phase extraction (MSPE). The combination of MSPE with high-performance liquid chromatography separation together with ultraviolet detection (HPLC-UV) was established as an effective method for the determination of four sulfonamide (SA) residues in surface water surrounding a cattle farm. The synthesized magnetic material was characterized by SEM, TEM, FT-IR, magnetic properties measurement system (MPMS), and nitrogen gas porosimetry. The material possessed many attractive features, such as a unique microporous structure, a larger specific surface area (137.93 m2·g−1) than bare Fe3O4 (24.84 m2·g−1), high saturation magnetization (50.5 emu·g−1), open adsorption sites, and high stability. The influencing parameters, including pH, the used amount of MCOPs, the type of eluent, adsorption solution, and desorption time, were optimized. Under the optimized conditions, the method conferred good linearity ranges (R2 ≥ 0.9990), low detection limits (S/N = 3, LOD, 0.10–0.25 μg·L−1), and satisfactory recoveries (79.7% to 92.2%). The enrichment factor (EF) for the four SAs was 34.13–38.86. The relative standard deviations of intraday (n = 5) and of interday (n = 3) were less than 4.8% and 8.9%, respectively. The equilibria between extraction and desorption for SAs could be reached within 150 s. The proposed method was sensitive and convenient for detecting SA residues in complex environmental matrices, and the successful application of the new MCOPs as an adsorbent was demonstrated.