Based on the first-principles calculation, the electronic and optical properties of the graphene/MoS2 heterostructure at different twisting angles are studied. The interface contact type changes from N-Schottky contact to Ohmic contact with the interlayer twisting angle of 40.90°, which is accompanied by the interfacial charge transfer from graphene to MoS2, and the increase of the contribution of Mo-dxy, Mo-dx2-y2 orbitals in the conduction band and S-pz, Mo-s, Mo-pz and Mo-dz2 orbitals in the valence band. Interestingly, the absorption coefficient, reflectivity and refractive index are improved in the infrared region when the twisting angle is 40.90°. In the visible light range, the absorption coefficient increases, while the refractive index decreases, and the reflectivity at 2.8 eV increases. In the ultraviolet region, the absorption coefficient reaches 1.2×106 cm-1 at 11.6 eV with a twisting angle of 30°. The results provide an effective way to apply materials in the photoelectric field.