Karst tiankengs in China are globally significant locations for studying ecological environments and plant diversity. However, there are few reports on how the unique geographical environment of tiankengs affects plant genetic diversity and genetic structure. This study used Hyper-seq gene sequencing technology to develop large-scale genomic SNPs of Manglietia aromatica, both within and outside the tiankengs. Its aim was to investigate the impact of tiankengs on the genetic diversity and genetic structure of the M. aromatica population. The analysis results indicate that the genetic diversity of the populations within the tiankeng (π = 0.2044) is higher than that of the populations outside of it (π = 0.1671), indicating that the tiankengs have a positive impact on species diversity. The genetic differentiation coefficient (FST) between the populations inside and outside the tiankeng was 0.0534 and the FST values of populations within the tiankeng were 0.077, 0.082, and 0.141, meaning that the genetic variation in the tiankengs is very high. The genetic similarity outside the tiankengs is also very high, indicating that the tiankengs are effectively preserving the genetic diversity of M. aromatica. Furthermore, the gene introgression analysis results gave no proof of gene flow between the three tiankeng populations. This suggests that the tiankengs not only protect species diversity, but also hinder gene flow between populations to some extent. However, this hindrance may gradually subside with the evolution of the tiankengs. The genetic structure analysis revealed that the M. aromatica population in Guangxi, China, can be classified into three subpopulations. The first is the tiankeng subpopulation, including all the populations in tiankengs. The second subpopulation consists of populations surrounding the tiankengs. These two subpopulations are distributed in Leye County in northwestern Guangxi, China, and are very close to each other. The third is the Huanjiang subpopulation, which is located far away from the tiankengs. Considering the direction of gene flow and genetic structure, it is speculated that the populations in the tiankengs evolved from the populations near the pit mouth. This study confirms that the tiankengs are shelters and provide a suitable habitat for the endangered plant M. aromatica, because its genetic diversity is well conserved and the species is well adapted to the habitat within the tiankengs.