We often use the word "ironic" in casual conversation to mean either sarcastic or coincidental. Now we're not saying that Davie's narration is never funny, but in this case, we're using "ironic" in its narrower, literary sense. Ironic here means that the narrator and/or the reader is aware of something that one of the characters is not, usually to dramatic effect.
Older Davie, the narrator, often shares things with the reader that his younger self can't have known. Sometimes this means we get to laugh at his younger self's expense, as when Davie reveals that he could have escaped from Earraid at any time if he had just waited for low tide and walked across to the island of Mull. And sometimes it leaves us with a desire to return to the past: after all, Davie's not only telling us about his own history; he's also depicting Scotland's bygone days of rebels and Jacobites. We can find an example of both of these stylistic traits, irony and nostalgia, in this passage, for example:
This was but one of Cluny's hiding-places; he had caves, besides, and underground chambers in several parts of his country; and following the reports of his scouts, he moved from one to another as the soldiers drew near or moved away. By this manner of living, and thanks to the affection of his clan, he had not only stayed all this time in safety, while so many others had fled or been taken and slain: but stayed four or five years longer, and only went to France at last by the express command of his master. There he soon died; and it is strange to reflect that he may have regretted his Cage upon Ben Alder. (23.6)
The irony here is that Old Davie knows that Cluny is going to die four or five years after Young Davie meets him, in France. At the moment they meet, Cluny may seem at his least safe, living as a wanted man in a hut made out of living trees. But from the perspective of the future, Old Davie can say that "[Cluny] may have regretted his Cage upon Ben Alder." In other words, the moment when Cluny seemed most at danger may actually have been his most secure.
As for nostalgia, as Old Davie imagines Cluny's wish to go back to his "Cage upon Ben Alder," Davie is also calling up his own memories of his experiences on that same mountain. By cutting back and forth between Young Davie and the men around him on the one hand and Old Davie's memories of those same men on the other, Stevenson generates a strong sense of longing for the past. The language he uses suggests great nostalgia, both for Davie's own personal past and for the Scotland of outlaws and Highland rebel clans that had been largely lost by Stevenson's day.