Histone H3 lysine 9 (H3K9) methylation is a conserved modification that generally represses transcription. In Caenorhabditis elegans it is enriched on silent tissue-specific genes and repetitive elements. In met-2 set-25 double mutants, which lack all H3K9 methylation (H3K9me), embryos differentiate normally, although mutant adults are sterile owing to extensive DNA-damage-driven apoptosis in the germ line. Transposons and simple repeats are derepressed in both germline and somatic tissues. This unprogrammed transcription correlates with increased rates of repeat-specific insertions and deletions, copy number variation, R loops and enhanced sensitivity to replication stress. We propose that H3K9me2 or H3K9me3 stabilizes and protects repeat-rich genomes by suppressing transcription-induced replication stress.