The Asian elephant is mostly confined to mountainous ranges and therefore risks population fragmentation if hard protected area (PA) boundaries near steep slopes prevent movement. We tested whether elephant gene flow is (i) controlled by slope and (ii) affected by the interplay between barriers and slope. We used 176 unique genotypes obtained non-invasively from fresh elephant dung to assess individual-by-individual genetic distance across the Western Ghats of India, a biodiversity hotspot. To assess landscape distance, 36 resistance models were produced by transforming a slope raster. Core areas and corridors were calculated from the raster that provided the best correlation between the genetic and distance matrices. The influence of the closure of PAs on gene flow was examined for one region, the Nilgiri Biosphere Reserve. The best resistance raster obtained by transforming the slope occupancy model was better than Euclidean distance for explaining genetic distance, indicating that slope partially controls gene flow. Fencing elephant PAs on hilly terrain reduces core areas and disrupts corridors. Consequently, hard PA boundaries abutting slopes can fragment elephant populations, but this can be ameliorated by protecting the adjacent flatter terrain.