Intuition tells me that this is true but I am not sure how to prove this.
Attempt: If $M$ is a maximal ideal then $R[X]/M$ is a field. Suppose $M\cap R$ was not prime. Then $R/M\cap R$ is not an integral domain. So there is some $a,b$ non zero such that $ab=0$. But now we can consider these $a,b$ in $R[X]/M$. This contradicts $R[X]/M$ being a field.
A more general result:
Indeed $f$ induces an injective homomorphism $$\bar f:A/f^{-1}(\mathfrak q)\longrightarrow B/\mathfrak q.$$ Now, if $\mathfrak q$ is prime, the quotient $B/\mathfrak q$ is an integral domain, and $A/f^{-1}(\mathfrak q)$ is isomorphic to a subring, which, necessarily, is also an integral domain.