From this page of the Valheim guide you will learn why you need the palisade.
The world is not generated in its entirety as you play. A given area is loaded only when you approach it. This means that an undiscovered object is safe as long as no one is standing next to it.
When you arrive near a building, it becomes vulnerable to enemy attacks. In order to avoid damage, it is safest to just set up a palisade. It fends off structures inside and slows down a potential attack. However, you must keep in mind that they are not indestructible. Additionally, they must be closed so that enemies cannot get inside.
The palisade are especially helpful when you're in trouble and could get killed. Then you can hide behind cover to regenerate your health. You can also repair the palisade from the outside during this time.