Revelation 7:3 Saying, Hurt not the earth, neither the sea, nor the trees, till we have sealed the servants of our God in their foreheads.
Revelation 9:4 And it was commanded them that they should not hurt the grass of the earth, neither any green thing, neither any tree; but only those men which have not the seal of God in their foreheads.
Revelation is a book of symbols. There is a similar symbol to this in a prophetic vision in the Old Testament. At the time of the Babylonian captivity Ezekiel was given a vision in which God separated the good from the bad in Jerusalem by symbolically marking them in the forehead.
Ezekiel 9:2 And, behold, six men came from the way of the higher gate, which lieth toward the north, and every man a slaughter weapon in his hand; and one man among them was clothed with linen, with a writer’s inkhorn by his side: and they went in, and stood beside the brasen altar. 3 And the glory of the God of Israel was gone up from the cherub, whereupon he was, to the threshold of the house. And he called to the man clothed with linen, which had the writer’s inkhorn by his side; 4 And the LORD said unto him, Go through the midst of the city, through the midst of Jerusalem, and set a mark upon the foreheads of the men that sigh and that cry for all the abominations that be done in the midst thereof. 5 And to the others he said in mine hearing, Go ye after him through the city, and smite: let not your eye spare, neither have ye pity: 6 Slay utterly old and young, both maids, and little children, and women: but come not near any man upon whom is the mark; and begin at my sanctuary.
In this vision we see that those who sighed and cried for the abominations committed by Israel in Jerusalem were saved from the sword by a mark set upon their forehead. We might reasonably suppose they were marked in the forehead because their way of thinking was in tune with God’s
This being a vision the import is that those who were on God’s side who were sorry for the evil behaviour of the inhabitants of Jerusalem would be saved from the sword of the Babylonians when they sacked the city. They were not literally marked.
In Revelation the Christian Church had fallen into apostasy as had the Jews before them. God was raising up the scourge of Islam, represented by the locusts from the bottomless pit. Islam was to attack Christendom over several centuries, eventually taking Constantinople and bringing to an end the Eastern Roman Empire.
The symbolic sealing of some in the forehead indicates that God was making a difference between those Christians who had retained the truth and those who were apostate. The former would be protected in the wars that followed.
I hope you have found this helpful.