Psychedelic drug experiences are shaped by current-moment contextual factors, commonly categorized as internal (set) and external (setting). Potential influences of past environments, however, have received little attention. To investigate how previous environmental stimuli shaped the experiences of patients receiving ketamine for treatment-resistant depression (TRD), and develop the concept of "imprinting" to account for such time-lagged effects across diverse hallucinogenic drugs. Recordings of treatment sessions and phenomenological interviews from 26 participants of a clinical trial investigating serial intravenous ketamine infusions for TRD, conducted from January 2021 to August 2022, were retrospectively reviewed. A broad literature search was undertaken to identify potentially underrecognized examples of imprinting with both serotonergic and atypical psychedelics, as well as analogous cognitive processes and neural mechanisms. In naturalistic single-subject experiments of a 28-year-old female and a 34-year-old male, subjective ketamine experiences were significantly altered by varying exposures to particular forms of digital media in the days preceding treatments. Higher levels of media exposure reduced the mystical/emotional qualities of subsequent psychedelic ketamine experiences, overpowering standard intention-setting practices and altering therapeutic outcomes. Qualitative data from 24 additional patients yielded eight further spontaneous reports of past environmental exposures manifesting as visual hallucinations during ketamine experiences. We identified similar examples of imprinting with diverse psychoactive drugs in past publications, including in the first-ever report of ketamine in human subjects, as well as analogous processes known to underly dreaming. Past environmental exposures can significantly influence the phenomenology and therapeutic outcomes of psychedelic experiences, yet are underrecognized and understudied. To facilitate future research, we propose expanding the contextual model of psychedelic drug actions to incorporate imprinting, a novel concept that may aid clinicians, patients, and researchers to better understand psychedelic drug effects. ClinicalTrials.gov, identifier NCT04701866.