Can't you just multiply the frequency of the accelerometer by the frequency of the gyroscope?
Imagine that f1 samples every four time units and f2 samples every three time units. If the sampling is regular and they begin to sample at same time they will meet every twelve time units.

e.g.
if the accelerometer has 40 samples every 5 seconds and the gyro has 1332 samples in the same amount of time.
to calculate the frequency:
the accelerometer has 40/5 = 8 samples per second
the gyro has 1332/5 = 266.4 samples per second
to calculate the period (in milliseconds):
the accelerometer samples every 1000/8 = 125 millisecond
the gyro samples every 1000/266.4 = 3.75 millisecond
therefore they will meet every 125 * 3.75 = 469 millisecond