We investigated the patterns and drivers of bacterial α- and β-diversity, along with viral and prokaryotic abundance and the carbon production rates, in marine surface and subsurface sediments (down to 1 m depth) in two habitats: vegetated sediments (seagrass meadow) and non-vegetated sediments. Prokaryotic abundance and production decreased with depth in the sediment, but cell-specific production rates and the virus-to-prokaryote ratio increased, highlighting unexpectedly high activity in the subsurface. The highest diversity was observed in vegetated sediments. Bacterial β-diversity between sediment horizons was high, and only a minor number of taxa was shared between surface and subsurface layers. Viruses significantly contributed to explain α- and β-diversity patterns. Despite potential limitations due to the only use of fingerprinting techniques, this study indicates that the coastal subsurface host highly active and diversified bacterial assemblages, that subsurface cells are more active than expected and that viruses promote β-diversity and stimulate bacterial metabolism in subsurface layers. The limited number of taxa shared between habitats, and between surface and subsurface sediment horizons, suggests that future investigations of the shallow subsurface will provide insights into the census of bacterial diversity, and the comprehension of the patterns and drivers of prokaryotic diversity in marine ecosystems.