We sat and waited in the emergency room for hours on end.
The Ngram demonstrates that the frequency of usage of the saying is hours, then days, then months, lastly years - which might have been expected.
Quora, in answer to the question of origin states :
The idiomatic "on end" -- meaning consecutively, without intermission -- dates back to 1634, according to the Oxford English Dictionary.
But that is not quite correct, for the 1634 reference is not about time at all.
1634 S. Rutherford Lett. (1863) I. xxxii. 111 And was brought, thrice on end, in remembrance of you in my prayer to God.
The first quote I can find that is relevant is just four lines below the 1634 one :
1882 W. Besant All Sorts of Men I. vii. 184 Working sixteen hours on end at twopence an hour.
But what does it actually mean ? Is the concept viewing time like a ladder, up-ended, so that we look at the stretchers of the ladder (one above the other) like hour-long slats heaped up ?
I wonder if 'on end' originally came from the expression 'end on end' regarding physical objects laid end against end in a line.
The Ngram for 'end on end' shows that it pre-dates 'on end' by twenty years.