The synchronization of laser and X-ray sources is essential for time-resolved measurements in the study of ultrafast processes, including photo-induced piezo-effects, shock wave generation, and phase transitions. On the one hand, optical diagnostics (by synchronization of two laser sources) provides information about changes in vibration frequencies, shock wave dynamics, and linear and nonlinear refractive index behavior. On the other hand, optical pump–X-ray probe diagnostics provide an opportunity to directly reveal lattice dynamics. To integrate two approaches into a unified whole, one needs to create a robust method for the synchronization of two systems with different repetition rates up to the MHz range. In this paper, we propose a universal approach utilizing a field-programmable gate array (FPGA) to achieve precise synchronization between different MHz sources such as various lasers and synchrotron X-ray sources. This synchronization method offers numerous advantages, such as high flexibility, fast response, and low jitter. Experimental results demonstrate the successful synchronization of two different MHz systems with a temporal resolution of 250 ps. This enables ultrafast measurements with a sub-nanosecond resolution, facilitating the uncovering of complex dynamics in ultrafast processes.