For the first time, an in situ stir bar dispersive liquid-liquid microextraction approach has been developed and coupled with headspace gas chromatography-mass spectrometry for the determination of a group of organic pollutants. The method exploits a new generation of magnetic ionic liquids (MILs) that contain paramagnetic cations based on Ni2+ or Co2+ metal centers coordinated with either N-butylimidazole or N-octylimidazole ligands and chloride anions. The reactants are added to an aqueous solution containing a high field neodymium rod magnet, followed by the addition of the bis[(trifluoromethyl)sulfonyl]imide anion that promotes a metathesis reaction for the in situ generation of a hydrophobic MIL. Concurrently, a high stirring rate is maintained to exceed the magnetic field of the rod magnet and disperse the generated MIL in the sample solution. When stirring is stopped, the MIL coats the rod magnet due to its paramagnetic nature, facilitating the MIL transfer and subsequent desorption and analysis. Under optimum conditions, the method required a 2.5–18% (w/v) aqueous solution of sodium chloride, 10 mL of sample, 20 or 30 mg of MIL, the addition of a small volume of dispersive solvent, and stirring for 5–7.5 min, depending on the MIL. The method provided limits of detection (LODs) down to 10 μg L−1, adequate reproducibility (with relative standard deviation values lower than 10% for a spiked level of 80 μg L−1), and relative recoveries between 72.5% and 102%. Furthermore, the method was successfully applied in the analysis of tap and mineral water.