Frankly, I don't like either option. They are grammatical, but I can't imagine any native speaker of English phasing a conditional that way. David's examples "If he hadn't looked ... " and "If he didn't look ... " are much more natural.
The only option that works for me is simply "walked":
Without looking where he was going, the man walked into a tree.