Disclaimer: Where possible you should use the class specific stuff (so the beamer code provided by @samcarter in this case). The following answer is just a quick writeup on how one should do such redefinitions to keep all the possibilities of a macro like \section.
You should use \LetLtxMacro from the letltxmacro package for macros taking an optional in general. For the \section macro this doesn't seem necessary (at least with the article class) as it isn't defined with something like \newcommand.
Still you'll have to make sure that you test for an optional star and the optional argument. The optional argument shouldn't be passed on as is, as with the default empty argument you'll only get empty entries in the ToC. The following does the test for a star using the \@ifstar macro. It also uses & as the default content of the optional argument to test whether it was used at all. One could do this differently using \@ifnextchar[, but the approach here is easier to code.
\documentclass[]{article}
\let\oldsection\section
\makeatletter
\renewcommand\section
{%
\@ifstar
{\sectionauxB}
{\sectionauxA}%
}
\newcommand\sectionauxA[2][&]
{%
\ifx%
\oldsection{#2}%
\else
\oldsection[#1]{#2}%
\fi
}
\newcommand\sectionauxB[1]
{%
\oldsection*{#1}%
}
\makeatother
\begin{document}
\tableofcontents
\section{Test}
\section[Tes]{Test}
\end{document}
Alternatively using \@ifnextchar:
\documentclass[]{article}
\let\oldsection\section
\makeatletter
\renewcommand\section
{%
\@ifstar
{\sectionauxD}
{\sectionauxA}%
}
\newcommand\sectionauxA
{%
\@ifnextchar[
{\sectionauxB}
{\sectionauxC}%
}
\@ifdefinable\sectionauxB
{%
\long\def\sectionauxB[#1]#2{\oldsection[#1]{#2}}%
}
\newcommand\sectionauxC[1]
{%
\oldsection{#1}%
}
\newcommand\sectionauxD[1]
{%
\oldsection*{#1}%
}
\makeatother
\begin{document}
\tableofcontents
\section{Test}
\section[Tes]{Test}
\end{document}