How to make a rule under each section title with KOMA-Script?

This will be possible with KOMA-Script version 3.19 or newer. There is a newcommand \sectionlinesformat that can be redefined to insert the line after a section title.

\documentclass{scrreprt}[2015/09/15]% needs Version 3.19 or newer

\makeatletter
\renewcommand{\sectionlinesformat}[4]{%
\ifstr{#1}{section}{%
    \parbox[t]{\linewidth}{%
      \raggedsection\@hangfrom{\hskip #2#3}{#4}\par%
      \kern-.75\ht\strutbox\rule{\linewidth}{.8pt}%
    }%
  }{%
    \@hangfrom{\hskip #2#3}{#4}}% 
}
\makeatother

\usepackage{blindtext}% only dummy text
\begin{document}
    \chapter{The first chapter}
    \section{A nice section}
    \Blindtext[2]
    \addsec{A nice section without number}
    \blindtext
\end{document}

Result:

enter image description here


Maybe this might be a start.

\documentclass{scrreprt}
\let\svsection\section
\def\section#1{\svsection{#1}\noindent\smash{\rule[3ex]{\textwidth}{2pt}}\par%
  \vspace{-\baselineskip}\noindent}
\begin{document}
    \chapter{The first chapter}
    \section{A nice section}
    Some text
\end{document}

enter image description here