Can refer to a physical trench or a metaphorical one.
Los soldados se refugiaron en la trancha para protegerse del fuego enemigo.
The soldiers took refuge in the trench to protect themselves from enemy fire.
La trancha que excavaron los soldados estaba llena de agua lluvia.
The trench that the soldiers dug was full of rainwater.