Obviously you can't. The geofence (as implemented in ArduPilot) is simply a safety measure; once the aircraft passes outside of a defined zone, it returns to a pre-determined waypoint inside the fence and waits for further pilot commands.
To answer the initial question, the latest versions of ArduPilot implement terrain following (based on terrain data loaded into the flight computer before-hand). Additionally, there is also now support for range-finding instruments like Lidar Lite [0], although I don't believe those are currently being used in the terrain following mode. Such instruments could conceivably be used to implement "look-ahead" functionality to more accurately avoid obstacles.