This work aimed to fabricate a magnetically modified biochar (MBC) through a one-step pyrolysis of Vitex doniana nut at 500 °C and investigate its feasibility for the removal of two pharmaceuticals, namely, amoxicillin (AMX) and trimethoprim (TMT) from aqueous environment. The textural characteristics, chemical composition and magnetic properties of the MBC were analyzed using Brunauer-Emmett-Teller (BET) analysis, scanning electron microscopy (SEM), Fourier Transform Infrared (FTIR) spectroscopy, X-ray diffraction (XRD) and vibrating sample magnetometer (VSM). The results demonstrated the successful incorporation of the magnetic particles in the biochar matrix. The specific surface area and average pore volume of the MBC were obtained as 108.90 m2/g and 2.98 cm3/g, respectively. The adsorption process was observed to be strongly pH-dependent, and equilibrium was attained within 1 h. The kinetic data favors pseudo-second-order model (R2 > 0.999), implying that the most plausible mechanism for the adsorption was chemisorption. The isothermal data was best fitted by the Langmuir model (R2 > 0.985), signifying that the process was mainly monolayer adsorption on homogeneous surface. The maximum adsorption capacity achieved for AMX and TMT was 41.87 and 55.83 mg/g at 303 K, respectively. The thermodynamic examination highlighted that the adsorption was feasible and accompanied with absorption of heat and increase of entropy for both the adsorbates. Furthermore, the MBC exhibited a good recycling capability such that the adsorption capacity decreases by ~ 25% after reuse for six cycles. Besides, the theoretical results based on density functional theory (DFT) calculations demonstrated that the TMT molecules (ΔE = 3.762 eV) are more reactive compared to the AMX molecules (ΔE = 3.855 eV) which correlates with the experimental observations.