We report on the first, to the best of our knowledge, passive Q-switching operation at 2.3 µm passively based on Tm:YAIO3 (Tm:YAP) 3H4→3H5 transition with sulfur-doped graphitic carbon nitride (g-gC3N4) as the saturable absorber. Sulfur-doping engineering in g-C3N4 was manifested to enhance its mid-infrared nonlinear saturable absorption characteristics, which was confirmed by the conventional open-aperture Z-scan experiment with the excitation at 2.3 µm. The large effective nonlinear absorption coefficient of S-gC3N4 was determined to be -0.68cm/GW, indicating the remarkable MIR optical response. Initiated by S-gC3N4, a passively Q-switched laser operating at 2274.6 nm was configured with a-cut 3.0 at.% Tm:YAP as the gain medium. Stable Q-switching pulses were generated with the shortest pulse width of 140 ns, corresponding to the maximum peak power of 21.8 W. The experimental results reveal the effectiveness of sulfur doping to improve the performance of g-C3N4 in the MIR pulse generation.