If the option answers
is not needed as a global option that would be applied during the loading of whatsoever packages also, but is to be applied only during the loading of the documentclass exam, then you probably can create a .tex-file, let's call it test.tex, where the answers
-option is not given, but which creates an auxiliary file test-solutions.tex with the following content:
\PassOptionsToClass{answers}{exam}%
\input test.tex
Then you can first compile/build test.tex and then test-solutions.tex.
Something like:
%==========This snippet creates \jobname-solutions.tex only
% in case both it does not already exist and
% \jobname does not contain the phrase "-solutions".
%
% This snippet could go into an input-file on its own
% which is to be loaded via \input right before the
% \documentclass-command.===============================================
\begingroup\makeatletter
\newcommand\GobbleToNamePostfix[1]{%
\long\def\GobbleToNamePostfix##1#1{}%
\expandafter\endgroup
\ifcat$\detokenize\expandafter\expandafter\expandafter{%
\expandafter\GobbleToNamePostfix\jobname#1}$%
\else\expandafter\@gobble\fi
{%
% \jobname does not contain the phrase #1:
\IfFileExists{\jobname#1.tex}{}{%
\begingroup
\immediate\openout\@auxout\jobname#1.tex
\immediate\write\@auxout{%
\string\PassOptionsToClass{answers}{exam}\@percentchar
}%
\immediate\write\@auxout{\string\input\space\jobname.tex}%
\immediate\closeout\@auxout
\endgroup
}%
%%
%% If \write18 is enabled, e.g., by calling the compiler
%% with the --shell-escape-option, like
%% latexmk -shell-escape -xelatex test.tex
%% , then here you can do a call to the shell for
%% building \jobname#1.tex/test-solutions.tex:
%%
%\RequirePackage{shellesc, iftex}%
%\ShellEscape{%
% latexmk
% -\ifluatex lua\fi\ifpdftex pdf\fi\ifxetex xe\fi latex \jobname#1.tex%
%}%
}%
}%
\begingroup
%-------------------------------------------------------------------------------
% Here goes the phrase to append to name of .tex-file also delivering solutions:
\renewcommand\GobbleToNamePostfix{-solutions}%
%-------------------------------------------------------------------------------
\@onelevel@sanitize\GobbleToNamePostfix
\expandafter\endgroup\expandafter
\GobbleToNamePostfix\expandafter{\GobbleToNamePostfix}%
%==================== end of snippet ===========================================
%
%\show\GobbleToNamePostfix %yields: > \GobbleToNamePostfix=undefined.
%
\documentclass[french,a4paper,addpoints,11pt]{exam}
\usepackage[T1]{fontenc}
\usepackage{babel}
\makeatletter
\@ifclasswith{exam}{answers}{\def\Answertext{With Answers.}}%
{\def\Answertext{Without Answers.}}%
\makeatother
\begin{document}
\Answertext
\begin{questions}
\question[10]Why is there air?
\begin{solution}
Because nobody breathed it away yet.
\end{solution}
\end{questions}
\end{document}
When saving this as test.tex and compiling it, you get test.pdf:

and test-solutions.tex:
\PassOptionsToClass{answers}{exam}%
\input test.tex
When compiling test-solutions.tex, then you get test-solutions.pdf:

Alternatively uncomment/activate the lines
%\RequirePackage{shellesc, iftex}%
%\ShellEscape{%
% latexmk
% -\ifluatex lua\fi\ifpdftex pdf\fi\ifxetex xe\fi latex \jobname#1.tex%
%}%
to be
\RequirePackage{shellesc, iftex}%
\ShellEscape{%
latexmk
-\ifluatex lua\fi\ifpdftex pdf\fi\ifxetex xe\fi latex \jobname#1.tex%
}%
and just compile test.tex via
latexmk -shell-escape -xelatex test.tex
.
This way test.pdf and test-solutions.pdf should be created in one go.