Global warming reportedly poses a critical risk to coral reef ecosystems. Bacteria and archaea are crucial components of the coral holobiont. The response of archaea associated with warming is less well understood than that of the bacterial community in corals. Also, there have been few studies on the dynamics of the microbial community in the coral holobiont under long-term heat stress. In order to track the dynamic alternations in the microbial communities within the heat-stressed coral holobiont, three-week heat-stress monitoring was carried out on the coral Pocillopora damicornis. The findings demonstrate that the corals were stressed at 32 °C, and showed a gradual decrease in Symbiodiniaceae density with increasing duration of heat stress. The archaeal community in the coral holobiont remained relatively unaltered by the increasing temperature, whereas the bacterial community was considerably altered. Sustained heat stress exacerbated the dissimilarities among parallel samples of the bacterial community, confirming the Anna Karenina Principle in animal microbiomes. Heat stress leads to more complex and unstable microbial networks, characterized by an increased average degree and decreased modularity, respectively. With the extension of heat stress duration, the relative abundances of the gene (nifH) and genus (Tistlia) associated with nitrogen fixation increased in coral samples, as well as the potential pathogenic bacteria (Flavobacteriales) and opportunistic bacteria (Bacteroides). Hence, our findings suggest that coral hosts might recruit nitrogen-fixing bacteria during the initial stages of suffering heat stress. An environment that is conducive to the colonization and development of opportunistic and pathogenic bacteria when the coral host becomes more susceptible as heat stress duration increases.