When Legolas believed Aragorn to be dead, he knew that he would also die, and that soon. Oh, he would not fade - not unless by some mischance he survived the battle for Rohan. But he would go into battle not expecting to last the night. And soldiers with no hope are often the first to die.
When Aragorn returned to them, against all expectation, Legolas vowed to live for as long as he was needed. He would fight at Aragorn's side and die, if such must be, in the last defence of the Man.
He knew, now, what it meant that Aragorn was mortal. And he swore a private oath that he would remain in Middle Earth until Aragorn was no more. Whether that meant the two falling in battle together, or Legolas watching the aged Elessar pass quietly in his bed, it would be thus. He would not leave. Even if it meant never sailing, and seeking Mandos' halls at his end, such was his doom. And he would face it gladly.