The Romans used a system of rotating out the front rank through a shield push. But how did other soldiers, for example the Greek Hoplites, fight in battles which often lasted hours without getting rest? If they didn't get rest, then does this mean that being placed in the front rank is a sure death sentence since the soldier would eventually get tired?
who says they didn't get tired? Of course they did, but so did their opponents.
And who says they didn't get rotated? Most of those battles were not slugging matches with people bashing swords and shields (or lances) together for hours and hours on end. They were position games, each side's phalanxes marching across terrain trying to get an advantage, then eventually closing for an engagements.
Often there would have been extended rest periods that way, chance for the formation to change too.
Don't think of ancient battles being like the 24/7 fighting we have today, and even there each individual unit isn't in action constantly, they're pulled back to the rear after a few hours, there's lulls in the action as it moves to another corner of the field, etc. etc.
And without the mechanised forces we have now, the pace was slower. On a field a few kilometers on a side, it could take hours to jostle for position before the actual fighting started (except maybe for some harassment by cavalry or archers dashing in and out at times).