Brain-derived neurotrophic factor (BDNF) is essential for cognitive and memory functions. Abnormal BDNF expression in the central nervous system may impair these functions. Anaesthesia and surgery can induce perioperative neurocognitive disorders (PND). Clinical studies show that BDNF expression is decreased in patients presenting with cognitive impairment after anaesthesia and surgery. However, the molecular mechanism is still unclear. Epigenetic regulation plays an important role in cognition. The hypermethylation of H3K9 is crucial for transcriptional silencing and the onset of cognitive disorders. Here, we hypothesised that H3K9 trimethylation repressed BDNF expression and impaired memory formation or recall during anaesthesia and surgery. Laparotomy under isoflurane inhalation anaesthesia, behavioural tests, Western blotting, quantitative real-time reverse-transcription polymerase chain reaction (qRT-PCR), chromatin immunoprecipitation (ChIP), and immunohistochemistry were used in this study. BDNF expression was decreased in the hippocampus after anaesthesia and surgery. Cognitive impairment affected memory formation but not recall. The trimethylation of H3K9 downregulated BDNF expression. The overexpression of BDNF or use of exogenous BDNF improved the impairment of memory formation caused by anaesthesia and surgery. Therefore, inhibiting H3K9 trimethylation and increasing the expression of BDNF may help prevent PND in the clinical setting.