This command (as most) will only take effect inside the group or environment in which it is defined; in particular, when put inside a frame environment

% ...
\begin{frame}
   ...
\end{frame}

it will only affect the font sizes of this frame.

Examples of changing font size in Beamer

% Change font size in Beamer
\documentclass{beamer}

% set a theme
\usetheme{CambridgeUS} 

% Dummy text
\usepackage{lipsum}  

\begin{document}

\begin{frame}{Frame with different font sizes and spacing }{size: 9pt, vskip=10pt}

\fontsize{9pt}{10pt}\selectfont
    
\lipsum[2]
    
\end{frame}
\end{document}

If you find this post helpful, please share it!