Optical fiber sensors fabricated by bonding have several limitations. To address these limitations, a CO2laser welding process for an optical fiber and quartz glass ferrule is proposed in this study. A deep penetration welding method with optimal penetration (penetrating the base material only) is presented to weld a workpiece according to the requirements of the optical fiber light transmission, size characteristics of the optical fiber, and the keyhole effect of the deep penetration laser welding. Moreover, the influence of laser action time on the keyhole penetration is studied. Finally, laser welding is performed with a frequency of 24 kHz, power of 60 W, and duty cycle of 80% for 0.9 s. Subsequently, the optical fiber is subjected to out-of-focus annealing (0.83 mm, 20% duty cycle). The results show that deep penetration welding produces a perfect welding spot and has good quality; the hole generated from deep penetration welding has a smooth surface; the fiber can bear a maximum tensile force of 1.766 N. The performance of the optical fiber sensor is stable, and the maximum pressure deviation corresponding to the cavity length fluctuation is about 7.2 Pa. Additionally, the linear correlation coefficient R of the sensor is 0.99998.