march in time (with someone or something)
To follow or maintain the proper rhythm of someone or something else while marching. It was impressive to see so many troops all marching in time during the military parade. The children marched in time with their teacher as they walked to the library.