A commutative ring $R$ always has at least one ideal: $R$ and $\{0\}$ are examples (but they might not be two examples).
If $R$ has exactly one ideal, one apparently has $R=\{0\}$, and $R$ is not a field (because one of the field axioms is $0\neq1$, which is precisely listed to exclude this ring; all other field axioms are satisfied).
If $R$ has exactly two ideals, then firstly $R\neq\{0\}$, so these ideals are precisely $R$ and $\{0\}$. Then for any $a\in R\setminus\{0\}$, the ideal $aR$ it generates is not $\{0\}$ so it must be $R$. In particular $1\in aR$ and $a$ is invertible; this holds for any nonzero $a$ so $R$ is a field.
If $R$ has an ideal $I$ with $I\neq\{0\}$ and $I\neq R$, then $1\notin I$ (otherwise $a=1.a\in I$ for all $a\in R$ contradicting $I\neq R$), and choosing $a\in I\setminus\{0\}$ we have $1\notin aR\subseteq I$ so $a$ is non-invertible and $R$ is not a field.
If $R$ is not commutative, it depends on what "ideal" means. Taking it to mean "right ideal" the above remains valid, and one can conclude that the only rings with exacly two right ideals are the skew fields (division rings). But if one takes (more reasonably) "ideal" to mean "two-sided ideal", then the statement becomes false. There are non-commutative rings with exactly two two-sided ideals that are not division rings: a matrix ring over a field is an example. So one may assume that the context of your quotation is such that "characterized" is to be taken "among commutative rings".