Yes you can, using the Restrict Editing feature.
Create the header and footer for the document. On the Review tab click on Restrict Editing.
Once you do that, the Restrict Editing pane will appear.
First, press Ctrl+A to select the entire document, even if there isn’t much text yet. (This will not select the header and footer.)
Then, check the number 2 box – Editing restrictions and make sure that no changes are enabled.
In the Exceptions section click on Everyone. This will allow everyone to make changes to the area you just selected within the body of the document.
Now click on Yes, Start Enforcing Protection.
You will be prompted for a password, which is optional. Once you click on OK for the password, the Restrict Formatting and Editing pane will show the following options. You can unselect Highlight the regions I can edit so that the yellow markings disappear.
Now users will be able to edit the document but not touch the header and footer.