Intracellular invasion and the survival of Staphylococcus aureus in phagocytic cells has been regarded as one of the mechanisms that leads to the treatment failure of S. aureus infection and potential antibiotic resistance. The detection of infected phagocytic cells plays an important role in guiding antibiotic treatment and in reducing drug resistance. The development of a sensitive and specific imaging probe to visualize the intracellular bacteria is quite challenging. In this work, we report a photoacoustic agent (MPC) that is able to detect intracellular S. aureus infection through a dynamic process, including (i) active targeting and internalization into macrophage cells, (ii) specific molecular tailoring by caspase-1 in infected macrophage cells, and (iii) enhancement of the photoacoustic (PA) signal owing to molecular self-assembly. The PA signal per area of the “stimuli-induced assembly” agent (MPC) increases more than 2-fold over that of the active targeting control agent (MPSC). Finally, based on this approach, the average PA signal in the infected site is enhanced by approximately 2.6-fold over that of the control site. We envision that this PA contrast agent may provide a new approach for the selective and sensitive diagnosis of an intracellular bacterial infection.