For a compound expression, the original sense is the complete situation it ordinarily describes, not simply a list of dictionary roots. One relevant scene is physically moving one foot forward and then pulling another back.
The picture combines impulses toward progress and withdrawal. When the utterance addresses a person unable to decide, the bodily scene becomes a representation of mental hesitation.
Not every physical feature of the original event must recur in the new setting. The transferable element is the recognizable arrangement or pattern formed by the elements together; that is why the type of resemblance is called representative or composite.