The invention relates to the field of optical devices for hardening rails, in particular to an optical device for hardening the steel rail by using high-power semiconductor laser in running of a train. The optical device comprises semiconductor laser diode stacks, a polarization coupling prism, a wavelength coupling prism, a planar reflector, a symmetric ladder lens, a light beam compression lens, a slow-axis collimating lens, an optical working lens assembly and a laser head, wherein through the plurality of semiconductor laser diode stacks with fast-axis collimating lens, the light is coupled into a beam of light and output by using a wavelength coupling principle and a polarization coupling principle. The laser beam is led into the laser head so as to obtain ideal light spots required for hardening the steel rail by laser through light path design of a complete optical system. The device has the advantages of high energy utilization ratio, compact structure, convenient carrying and field application, high controllability, easy operation, low operation and maintenance cost, long service life, uniform energy distribution of light beam, no need of measures such as phosphorization, blackening and the like of the surface of the steel rail and capability of preventing negative effect brought by spraying an absorption layer.