Each tile will be given a list of dangers, like vacuum, hazardous atmosphere, radiation, etc. This will by listed on the tile's info. When pathfinding begins, each danger is assigned a modifier, based on what unit is starting the pathfinding. So calling the function will look like path(start, end, vacuum_weight, radiation_weight). A regular human might get path([1,1], [10,10], 1, 1) - they takes 100% damage from vacuum and radiation. A 'rockman' on the other hand, man not need to breathe and may suffer lesser damage from radiation, so if a rockman was going somewhere it'd be path([1,1], [10,10], 0, .5).
When calculating pathing cost, it has 3 factors to sum up. Regular pathfinding is F = G + H which is Total = Movement_Cost + Estimated_Distance. This helps going straight for the target instead of checking all sorts of path options. For mine, it'll be F = G + H + D. Total = Movement_Cost + Estimated_Distance + Danger. The "Danger" is factored against the unit's resistances, so it'd be vacuum_danger * vacuum_resistance - humans trying to path through a radiation saturated zone would get something like +1,000 to the cost to move through that tile, while a rockman would only get a +500 cost to move.
Eventually this would also be weighted against that particular unit's personality types - a "reckless" human might get a 20% cost reduction to all danger, so they'd be more likely to run through brief bouts of radiation to get somewhere more quickly and take radiation sickness, while an "unrepentant coward" might get a 1000x multiplier on danger weight, and simply refuse to pass through any dangerous terrain.