Is there any way to make a unit walk around a trap?
Solution 1:
In general, no. Units will always move in a direct path towards their goal, even into hazards, such as moats, traps, and the like. I've already lost a handful of turns trying to break down the gate while sieging a town because my units decide to assault from the angle that has them standing in the moat, first.
In this particular situation, it would take the full extent of your units movement just to draw vertically adjacent with the other stack. To avoid the square (and you do, because it'll remove the rest of your movement, anyway) would require more movement than your unit possesses.
To draw horizontally adjacent with the stack, however, may be possible if you play around with the pathing - the route your unit will take on a move is always slightly darker than the rest of the grid, and will dynamically update as you mouse over different squares. In this particular instance, you might have to settle for the square two to the left of your foremost stack.
Finally, traps do extremely inconsequential damage. If there's an enemy stack next to the trap, feel free to dive on top of it anyway - those traps just stop movement, they don't stop you from attacking as part of the same action.