Insert \rule in \tabularx?

I believe you want to fill out the space with the lines and also to give more room for the questions.

\documentclass[10pt]{article}
\usepackage[a4paper, total={18cm, 25cm}]{geometry}

\usepackage{tabularx,xparse}

\usepackage{lipsum}

\ExplSyntaxOn

\NewDocumentCommand{\notes}{O{10pt}m}
 {
  \prg_replicate:nn { #2-1 }
   {
    \raisebox{#1}{\strut}
    \hrulefill\par
   }
    \raisebox{#1}{\strut}
    \hrulefill
 }

\ExplSyntaxOff

\begin{document}

\noindent
\begin{tabularx}{\textwidth}{|>{\hsize=0.5\hsize\raggedright}X|>{\hsize=1.5\hsize}X|}
\hline
\textbf{Question} & \textbf{Answer} \\
\hline
\lipsum[1][1] & \notes{3}\\
\hline
\hline
foo & \notes{1}\\
\hline
\end{tabularx}

\end{document}

enter image description here

You can still call \notes[20pt]{3} if you want to leave more space between the lines.


As already mentioned in a comment, you can't use \\ to sart a new line here. I have therefore replaced the \\ with \newline in your definition of \notes. I have also slightly changed the order of some commands in order to allow for more space above the first line. Lastly, I have also added an example using tabular and placing the \notes command in a p type column as well as a tabularx example with an X type column:

enter image description here

\documentclass[10pt]{article}
\usepackage[a4paper, total={18cm, 25cm}]{geometry}
\usepackage{fontspec}
\usepackage[french]{babel}
\usepackage{tabularx}
\usepackage{pgffor, ifthen}

\newcommand{\notes}[3][\empty]{%
    \foreach \n in {1,...,#2}{%
        \ifthenelse{\equal{#1}{\empty}}
            {\rule{#3}{0.5pt}\newline}  %<---- replaced \\ with \newline here
            {\hspace{0pt}\newline\rule{#3}{0.5pt}\vspace{#1}} % <---- removed  \\ at the end of the line and placed  \hspace{0pt}\newline in the beginning 
        }
}

\begin{document}
\noindent
\begin{tabular}{|l|p{5.5cm}|}
    \hline
    \textbf{Question} & \textbf{Answer} \\
    \hline
    foo & \notes[10pt]{3}{5cm}\\
    \hline
    foo & \notes[10pt]{1}{5cm}\\
    \hline
\end{tabular}

\noindent
\begin{tabularx}{\textwidth}{|l|X|}
    \hline
    \textbf{Question} & \textbf{Answer} \\
    \hline
    foo & \notes[10pt]{3}{5cm}\\
    \hline
    foo & \notes[10pt]{1}{5cm}\\
    \hline
\end{tabularx}
\end{document}