You can (see daleif's comment) use the LaTeX kernel macro called \@ifclasswith to test whether or not the a5paper option was passed to memoir, and do different things accordingly. One potential downside of this approach is that using \@ifclasswith is only allowed in the preamble, not in the body of the document.

\documentclass[a5paper,10pt,oneside,onecolumn,openany]{memoir}
\usepackage{lipsum} % for filler text
\makeatletter
\@ifclasswith{memoir}{a5paper}
{%
% If the a5paper option was passed to memoir...
% do something interesting; for instance:
\AtBeginDocument{The pagesize is \texttt{a5paper}.\par}
}{%
% Otherwise...
% do something else.
}
\makeatother
\begin{document}
\lipsum[1]
\end{document}
Alternative solution
According to the memoir source code, passing the a5paper class option merely triggers
\newcommand*{\stockav}{\stockheight=210mm \stockwidth=148mm}
Therefore, if an alternative approach is needed, you can perform tests on the values of \stockheight and \stockwidth instead.
\documentclass[a5paper,10pt,oneside,onecolumn,openany]{memoir}
\usepackage{lipsum} % for filler text
\begin{document}
% test for a5paper
\ifdim\stockheight=210mm\relax
\ifdim\stockwidth=148mm\relax
% Put here what should only be applied only if the page size corresponds to A5 paper.
% For instance...
The pagesize is \texttt{a5paper}.\par
\fi
\fi
\lipsum[1] % for filler text
\end{document}