If you add a closing dot the the definition of \thesection, you should also remove the "middle" dot from definitions using \thesection, especially \theequation and \thesubsection. (Note that your redefinition of \thesection will also produce a closing dot in the table of contents, the header/footer, and cross references.)
\documentclass{article}
\usepackage{amsmath}
\renewcommand{\thesection}{\arabic{section}.}
\numberwithin{equation}{section}
\renewcommand{\theequation}{\thesection\arabic{equation}}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}}
\begin{document}
\section{foo}
\subsection{bar}
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\end{document}
EDIT: In response to Frank Mittelbach, here's an alternative that changes the \@seccntformat macro so that it adds a dot if the new \@seccntdot conditional is true. The etoolbox package is used to set this conditional to true before \section and to false after every equal/lower-level sectioning command.
\documentclass{article}
\usepackage{amsmath}
\numberwithin{equation}{section}
\usepackage{etoolbox}
\makeatletter
\newif\if@seccntdot
\pretocmd{\section}{\@seccntdottrue}{}{}
\apptocmd{\@xsect}{\@seccntdotfalse}{}{}
\def\@seccntformat#1{%
\csname the#1\endcsname
\if@seccntdot .\fi
\quad
}
\makeatother
\begin{document}
\section{foo}
\subsection{bar}
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
\end{document}
Output for both examples:
