Marking time is a military step in which soldiers march in place, moving their legs as in marching, but without stepping forward.[1]
The military drill command is "Mark Time!” to change from standing at attention to 'Marking Time' or to change from marching at 'Quick Time' to 'Marking Time'. The resulting action is to march in the same place, not to move in any direction. Also used during Color Guard maneuvers to make minor adjustments in a single file presentation of the colors.
The term can also be used to refer to doing a minor job or task while waiting for an opportunity to arise, thus the casual usage in slang as describing motion without progress – not getting anywhere. As with other military jargon it entered civilian use when a large portion of the population had military experience and understood the context.