Abstract The tumor microenvironment shapes immune surveillance through its mechanical properties, yet the role of matrix viscoelasticity remains unclear. Here, we used a collagen system with tunable viscoelasticity to define how matrix relaxation directs dendritic cell (DC) behavior. Elastic matrices impaired DC migration by limiting actomyosin-driven collagen remodeling, thereby reducing DC-T cell encounters and weakening T cell priming, activation, proliferation, and tumor killing. Blocking DC migration in fast-relaxing gels recapitulated key aspects of the impaired T cell priming seen in elastic matrices. Prolonged confinement in elastic extracellular matrix induced a mechanomemory state, locking DCs into reduced motility even after transfer to viscoelastic environments, corresponding to altered chromatin accessibility. Finally, studies with patient-derived ependymoma samples confirmed these findings, identifying viscoelasticity as a barrier to antitumor immunity with implications for therapeutic intervention.