KOMA-Script classes use package tocbasic
to configure the ToC entries. So you can use \DeclareTOCStyleEntry
/\DeclareTOCStyleEntries
and their option pagenumberformat
to change the format of the page number, e.g.:
\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mwe}
\DeclareTOCStyleEntries[%
pagenumberformat=\texttt
]{section}{section,subsection}
\DeclareTOCStyleEntry[%
pagenumberformat=\textbftt
]{chapter}{chapter}
\newcommand*{\textbftt}[1]{\textbf{\texttt{#1}}}
\begin{document}
\tableofcontents
\blinddocument
\end{document}
KOMA-Script classes also provide to set ToC entry options using \RedeclareSectionCommand
/\RedeclareSectionCommands
by adding the prefix toc
to the option name. So you can alternatively use, e.g.:
\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mwe}
\RedeclareSectionCommands[%
tocpagenumberformat=\texttt
]{chapter,section,subsection}
\begin{document}
\tableofcontents
\blinddocument
\end{document}
However, the digits of the default LaTeX fonts are table digits, so even
\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{mwe}
\begin{document}
\tableofcontents
\Blinddocument
\Blinddocument
\end{document}
does not result in jumping page numbers. If you are using a font, where the digits have different widths, you should have look, whether it also provides table digits with same width for all digits. In this case you should be able to use the format option also to select the table digits.