As GreginGre points out, the answer is no, since every field is a UFD that does not contain any prime elements. However, fields are indeed the only UFDs in which this can occur. To see this, let $R$ be any UFD that is not a field; then $R$ is automatically infinite, and $R$ contains at least one prime element $p$. We will show that $R$ has infinitely many prime elements. If the group of units $R^\times$ is infinite, then we are done, since the family $\{\lambda p:\lambda\in R^\times\}$ is a collection of distinct prime elements of $R$. Thus assume that $R^\times$ is finite; since $R$ is infinite, we are now in a position to replicate the proof of Euclid's theorem. Indeed, suppose $p_1,\dots,p_n\in R$ is any finite collection of prime elements of $R$. Since $R$ is infinite, the set $\{1+p_1\dots p_n s:s\in R\}$ is infinite as well, and since $R^\times$ is finite there thus exists some $s\in R$ such that $1+p_1\dots p_ns$ is not a unit. Since $R$ is a UFD, there is then some prime element $q$ that divides $1+p_1\dots p_ns$, and we cannot have $q=p_i$ for any $i\leqslant n$, so $q$ is a prime element of $R$ not among $p_1,\dots,p_n$. In particular, $R$ has infinitely many prime elements, as desired. So, to answer your question, any UFD that is not a field has infinitely many prime elements.
On the other hand, again as GreginGre comments, if you are willing to consider examples that have finitely many prime elements modulo units, then there can be counterexamples that are not fields. Here is a recipe for constructing such examples. Let $R$ be any UFD that is not a field and let $p_1,\dots,p_n\in R$ be any prime elements of $R$. Then the subset $S=R\setminus\bigcup_{i=1}^n\langle p_i\rangle$ is a complement of prime ideals, hence multiplicatively closed, and by Kaplansky's criterion the localization $S^{-1}R$ is a UFD. But every prime element of $S^{-1}R$ is associate to one of the $p_i/1$ (why?), so $S^{-1}R$ has only finitely many primes up to associativity, as desired.
For a very tractable example of this construction, let $R=\mathbb{Z}$, so that $p_1,\dots,p_n\in\mathbb{Z}$ are just integer primes. Then the ring $S^{-1}R$ indicated above is just the subring $$\left\{\frac{a}{b}:p_i\nmid b\text{ for each }i\leqslant n\right\}$$ of $\mathbb{Q}$; as an exercise, try to check directly that this ring is a UFD and that all of its prime elements are associate to some $p_i$.