From Civil War website The use of foxholes dates back to ancient times, with evidence of their use found in the trenches of World War I and World War II. However, it wasn't until the American Civil War that the term "foxhole" was first used to describe a hole dug for defensive purposes. The term is believed to have originated from the way the holes resembled the burrows of foxes.
As per Civil War Website.
The use of foxholes dates back to ancient times, with evidence of their use found in the trenches of World War 1 and World War 2. However, it wasn't until the American Civil War that the term "foxhole" was first used to describe a hole dug for defensive purposes. The term is believed to have originated from the way the holes resembled the burrows of foxes.