The host-associated microbiota is increasingly recognized to facilitate host fitness, but the understanding of the underlying ecological processes that govern the host-bacterial colonization over development and, particularly, under disease remains scarce. Here, we tracked the gut microbiota of shrimp over developmental stages and in response to disease. The stage-specific gut microbiotas contributed parallel changes to the predicted functions, while shrimp disease decoupled this intimate association. After ruling out the age-discriminatory taxa, we identified key features indicative of shrimp health status. Structural equation modelling revealed that variations in rearing water led to significant changes in bacterioplankton communities, which subsequently affected the shrimp gut microbiota. However, shrimp gut microbiotas are not directly mirrored by the changes in rearing bacterioplankton communities. A neutral model analysis showed that the stochastic processes that govern gut microbiota tended to become more important as healthy shrimp aged, with 37.5% stochasticity in larvae linearly increasing to 60.4% in adults. However, this defined trend was skewed when disease occurred. This departure was attributed to the uncontrolled growth of two candidate pathogens (over-represented taxa). The co-occurrence patterns provided novel clues on how the gut commensals interact with candidate pathogens in sustaining shrimp health. Collectively, these findings offer updated insight into the ecological processes that govern the host-bacterial colonization in shrimp and provide a pathological understanding of polymicrobial infections.