Ever since the Fall, believers have been in need of protection from common foes and dangers: (1) the malicious schemes of Satan and his hordes; (2) the rage of the world against the Church (these first two fall under the seed of the serpent, Gen. 3:15); and (3) from ourselves, the subduing and restraining of the flesh.
Let us, when we are secure in the Lord, rejoice that our position is unassailable, for he is our fortress as well as our refuge. No moat, portcullis, drawbridge, wall, battlement and donjon, could make us so secure as we are when the attributes of the Lord of Hosts environ us around. Behold this day the Lord is to us instead of walls and bulwarks! Our ramparts defy the leagued hosts of hell. Foes in flesh, and foes in ghostly guise are alike balked of their prey when the Lord of Hosts stands between us and their fury, and all other evil forces are turned aside. Walls cannot keep out the pestilence, but the Lord can.
And John Gill:
and my fortress: what fortifications, natural or artificial, are to a city and its inhabitants, that is God to his people, and much more; he is round about them, as the mountains were about Jerusalem; his salvation are walls and bulwarks to them; yea, he is a wall of fire about them, Psalm 125:2, they are kept by his power, as in a garrison, 1 Peter 1:5.
And B. M. Duncan:
The Psalmist says, moreover, that God is his “fortress.” Here the idea is changed—no longer a peaceful, quiet hiding place, but a tower of defence—strong, manifest, ready to meet the attacks of all enemies, ready and able to resist them all. God is a Friend who meets every want in our nature, who can supply every need. So when we are weak and fainting, and unable to meet the brunt of battle, and striving against sin and sorrow and the wrath of man He is our safe, quiet resting place—our fortress also where no harm can reach us, no attack injure us.