Update
With KOMA-Script version 3.19a or newer you simple have to redefine \sectionlinesformat to get the desired result:
\documentclass{scrartcl}[2015/10/03]
\renewcommand\sectionlinesformat[4]{%
\makebox[0pt][r]{#3}#4%
}
\usepackage[headwidth=textwithmarginpar]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
Original answer
Since KOMA-Script version 3.17 (current version on CTAN) you have to redefine the commands \sectionformat, \subsectionformat etc. instead \othersectionlevelsformat.
\documentclass{scrartcl}[2015/04/23]
\renewcommand\sectionformat{\makebox[0pt][r]{\thesection\autodot\enskip}}
\renewcommand\subsectionformat{\makebox[0pt][r]{\thesubsection\autodot\enskip}}
\renewcommand\subsubsectionformat{\makebox[0pt][r]{\thesubsubsection\autodot\enskip}}
\usepackage[headwidth=textwithmarginpar]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\pagemark}
\usepackage{blindtext}
\begin{document}
\Blinddocument
\end{document}
\setheadwidth[0pt]{textwithmarginpar}Want to add it to your answer? – Ingo Jan 11 '12 at 11:53\othersectionlevelsformathas three arguments. The KOMA-Script documentation (p. 109 of a current version) suggests\renewcommand*\othersectionlevelsformat[3]{\makebox[0pt][r]{#3\autodot\enskip}}– cgnieder Aug 20 '14 at 07:53