Xanthan gum (XG) biopolymer-based soil treatment is an effective soil improvement method. In this study, we explored the effect of XG on the undrained shear strength of clays (kaolinite and montmorillonite) in chemically distinct pore fluids. Among the pore fluids tested, the undrained shear strength of kaolinite was the highest in kerosene, followed by deionized (DI) water and brine. This study hypothesized that the interparticle forces and interactions dominated the undrained shear strength of the kaolinite clay. In contrast, montmorillonite showed the highest undrained shear strength with DI water, followed by brine and kerosene, likely due to the increase in thickness of the viscous double layer that reduced the undrained strength of the montmorillonite clay. XG also affected the undrained shear strength of the clays, possibly due to the increase in viscosity of the pore fluids and modification of the clay interparticle fabrics. In DI water, XG increased the undrained shear strength of kaolinite (maximum shear strength was observed in the sample with an XG-to-soil mass ratio of 0.5%) via water absorption. Simultaneously, XG decreased the undrained shear strength of montmorillonite, likely due to XG-induced particle aggregation resulting from the changes in the montmorillonite particle surface charges. In 2-M-NaCl brine, the undrained shear strength increased with the increase in XG content, regardless of the mineral types, owing to the salt-induced double-layer compression and increase in concurrent XG-induced pore-fluid viscosity. However, the unaffected and constant undrained shear strength of both clays in nonpolar kerosene suggests that hydrating XG is a prerequisite for its application in soil treatment.