Every card or run you move counts as one move, including a card sent to a free cell or foundation. Undo takes the move, and its count, back.
The move counter goes up by one each time you move something: a card to a free cell, a card to a foundation, or a card or whole run onto a column. Moving a run of five cards at once is still a single move.
Undo
Undo steps back up to 100 moves and restores the counter with the board, so taking a move back also takes its count back.
Why it matters
The weekly FreeCell leaderboard and the Daily FreeCell rank by fewest moves, so a tidy solution beats a lucky one. Moving runs in one go saves moves (how many cards you can move at once). The strategy guide and the full rules cover how to plan for it.