Every day at the end of the march Roman legions made a fortified camp. This camp was the same for every Legion every day, so that a legionnaire deployed to the opposite side of the Empire would still be able to find his way around. The camp involved digging a ditch around the outside of the camp and turning the soil into a wall around the camp. They would then construct a palisade wall on top of the soil and build watchtowers at regular intervals around the camp. This prevented them from being surprise attacked in the night, a common tactic in the time, and allowed isolated forces to hold out until they were relieved. The legions built these camps every day and when they were marching they often would simply take back the stacks they used for the wall, fill in the ditch and burn what they couldn't carry. They did this to prevent their fortifications from ever being used against them.
The standard Roman camp was not the limit of Roman battlefield fortifications. In some circumstances, especially when two skilled Roman generals fought, the armies would spend days trying to get the best position and fortify it to cut their enemy off from their supplies and spend far more time in forced marches and constructing fortifications than fighting. Romans were capable of digging complex series of trenches, moats, fields of sharpened stakes and towers large enough to house their ballista and archers (as they did in this image of the fortifications in the Battle of Alesia). They could quickly build formidable defenses and fight to the death for them but could just as quickly abandon them if their enemy changed positions and they were no longer advantagous.
The Romans were famed for their advanced siege engines. In that time period it was common for even small cities to protect themselves with walls- ranging from small palisades with wooden watch towers to shoot down from to massive stone walls with ramparts for archers. It was a common strategy to try to simply retreat into a city and wait until your enemy ran out of the food, money or political will required to fight and went home. To counter these walls Rome developed many different siege weapons to be used in different situations. One of the most common ways to take a city was to have ballista (which were essentially giant crossbows) and other siege equipment provide covering fire while infantry in testudo formation advanced to the wall with ladders and overwhelmed the defenders and to the gate to batter it down with a ram. However, in more heavily fortified cities Roman legions were known to build massive, mobile towers that were safe from arrow fire and simply push them to the wall and go from them to the wall or build a ramp up to the wall to make it effectively shorter. In some situations legions would even dig tunnels beneath enemy walls then collapse them, bringing the wall above tumbling down. Another strategy was to use massive catapults and onagers to destroy a wall from afar and then rush into the gap and take the city. Whatever the tactic, Romans were shockingly effective at taking walls and had the best siege engines in the world.