Consider the following example:

\documentclass[a4paper,12pt]{article}
\begin{document}
\tableofcontents
\newpage
\section{test}
\newpage
\setcounter{page}{22}
\section{introduction}
\newpage
\setcounter{page}{222}
\section{discussion}
\end{document}


which produces:

As you can see the page numbers are aligned so that ones are written under ones, tens are written under tens, etc. Was this alignment the aim of LaTeX or LaTeX aim was simply to put page numbers at the end of each line?

In other words, if this document was RTL, which of the followings would be the correct alignment of page numbers?

-
Correct in our opinion or correct w.r.t. some typographical standard? –  einpoklum Nov 5 '12 at 7:51
correct w.r.t. some typographical standard –  Vafa Nov 5 '12 at 7:56
What about alignment of roman numerals (where alignment according to the digit does not make sense). –  Guido Nov 7 '12 at 4:32

As far as I can remember, in Hebrew typesetting it is customary to align page numbers by the rightmost digit, that is, as in Vafa's second option. See, e.g. here or here. However, Microsoft Word aligns to the end-of-line (Vafa's first option).

-

In my opinion, the alignment of the numbers has nothing to do with the direction of the text.

Whether you write in english (LTR) or arabic (RTL), you should always align numbers on their right edge. The reason for this is that when using the hindu-arabic numeral system, you "sort of" write digits RTL: the smallest order of magnitude goes to the most right (the "ones"), with each following order of magnitude right on its left (the "tens", the "hundreds", etc.).
Given then that for readability consideration (the number one objective of typography) you should align digits that represent the same order of magnitude, you should align digits on their right edge in this / our numeral system.

If you were to use a numeral system that was "sort of" LTR, whatever the direction of the text, the logic would be to align the digits on their left edge.

Note that for the TOC in particular, you do not have to write the page numbers after their labels. Many books use styles that first write the page number followed by the label, as bellow:

but the page numbers would usually still be aligned on their right edge for readability (even if that degrades the page grid to some extent).

-