Examining the bacterial communities of offspring is key to understanding the establishment of coral-bacteria associations. Although high sensitivity to the environment is expected, previous studies have only examined bacterial communities of coral offspring in ex situ (laboratory) environments, not in in situ (field) environments. Here, we examined and compared the effect of ex situ and in situ environments on bacterial communities of newly released offspring (eggs and larvae) and their maternal colonies in two phylogenetically distant coral species with different reproductive modes: Dipsastraea speciosa (Scleractinia; spawner) and Heliopora coerulea (Octocorallia; brooder). Our results demonstrated that the spawning environments do not affect the bacterial composition in maternal colonies, but influence that of the offspring (eggs of D. speciosa and larvae of H. coerulea). Dominant bacterial operational taxonomic units (OTUs) varied between in situ and ex situ environments in the eggs of D. speciosa. The composition of bacterial communities among larvae of H. coerulea samples was more diverse in in situ environments than in ex situ environments. This study provides the first information on in situ bacterial communities in coral eggs and larvae and highlights their sensitivities to the local environment. Future studies must take into consideration the influence of ex situ environments on bacterial communities in coral offspring.