It works if you move the commands outside the frame:
\documentclass{beamer}
\mode<presentation>
\usepackage[turkish]{babel}
\usepackage{graphicx}
\begin{document}
\shorthandoff{=}
\begin{frame}
\begin{figure}
\centering
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\end{figure}
\end{frame}
\shorthandon{=}
\end{document}
or if you add the fragile option to the frame:
\documentclass{beamer}
\mode<presentation>
\usepackage[turkish]{babel}
\usepackage{graphicx}
\begin{document}
\begin{frame}[fragile]
\begin{figure}
\shorthandoff{=}
\centering
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\shorthandon{=}
\end{figure}
\end{frame}
\end{document}
As egreg mentions in his comment, you are using the utf8 option for inputenc, so you don't really need the = shorthands for the turkish module of babel, and you can simply deactivate them after \begin{document}:
\documentclass{beamer}
\mode<presentation>
\usepackage[utf8]{inputenc}
\usepackage[turkish]{babel}
\usepackage{graphicx}
\begin{document}
\shorthandoff{=}
\begin{frame}
\begin{figure}
\centering
\includegraphics[scale=0.3]{resimler/stmornek2.png}
\end{figure}
\end{frame}
\end{document}