Motivation behind the definition of Prime Ideal

Ideals were originally defined in analogy to numbers; in fact, "ideal" was used in place of Kummer's "ideal numbers" (which were introduced to provide a kind of "unique factorization" in the ring of cyclotomic integers $\mathbb{Z}[\zeta_p]$).

In this setting, the general philosophy is to translate divisiblity statements about numbers into statements about ideals, since every number corresponds to an ideal (the principal ideal it generates), but there may be ideals that don't correspond to "actual numbers" (the non-principal ideals).

In analogy to the integers, a number $p$ is prime if and only if $p\neq\pm 1$ and if $p|ab$, then $p|a$ or $p|b$. In the ideal-theoretic setting, divisibility was equivalent to containment, so the condition would be translated to "$(p)\neq (1)$ and $(ab)\subseteq (p)$ implies $(a)\subseteq (p)$ or $(b)\subseteq (p)$." Moving from principal to general ideals, we say the ideal $P$ is prime if and only if $P\neq R$ and if $AB\subseteq P$, then either $A\subseteq P$ or $B\subseteq P$.

From here, once the notion of ring was generalized away from rings-of-integers of number fields, the notion was kept.

(For commutative rings, the definition is equivalent to the statement "if $ab\in P$, then $a\in P$ or $b\in P$ ", but for noncommutative rings this condition is stronger; that is, if an ideal satisfies the element-theoretic version, then it is prime; but it can be prime and not satisfy the element-theoretic version; for example, in the ring of $2\times 2$ matrices over $\mathbb{R}$, the trivial ideal $(0)$ is prime, but there are certainly pairs of matrices, neither of them the zero matrix, whose product is the zero matrix.)

Addendum. Here is how Dedekind put it in Sur la Théorie des Nombres Entiers Algébriques (1877), translated as Theory of Algebraic Integers by John Stillwell, Cambridge University Press, 1966:

[L]et $\Omega$ be a field of finite degree $n$, and let $\mathfrak{o}$ be the domain of integers $\omega$ in $\Omega$. An ideal of this domain $\mathfrak{o}$ is a system $\mathfrak{a}$ of numbers $\alpha$ in $\mathfrak{o}$ with the following two properties:

I. The sum and difference of any two numbers in $\mathfrak{a}$ also belongs to $\mathfrak{a}$; that is, $\mathfrak{a}$ is a module.

II. The product $\alpha\omega$ of any number $\alpha$ in $\mathfrak{a}$ with a number $\omega$ in $\mathfrak{o}$ is a number in $\mathfrak{a}$.

...

We say that an ideal $\mathfrak{m}$ is divisible by an ideal $\mathfrak{a}$, or that it is a multiple of $\mathfrak{a}$, when all numbers in $\mathfrak{m}$ are also in $\mathfrak{a}$.

...

We finally remark that divisibility of the principal ideal $\mathfrak{o}\mu$ by the principal ideal $\mathfrak{o}\eta$ is completely equivalent to divisibility of the number $\mu$ by the number $\eta$. The laws of divisibility of numbers in $\mathfrak{o}$ are therefore included in the laws of divisibility of ideals.

...

An ideal $\mathfrak{op}$ is called prime when it is different from $\mathfrak{o}$ and divisible by no ideals except $\mathfrak{o}$ and $\mathfrak{p}$.

Later, Dedekind proves that in this context, $\mathfrak{m}\subseteq \mathfrak{n}$ if and only if there exists $\mathfrak{r}$ such that $\mathfrak{n}\mathfrak{r}=\mathfrak{m}$, establishing the link between "divisibility" in terms of inclusion, and divisibility in terms of multiplication, which holds in these kinds of rings but not in general. He called it the hardest part of the development.


Arturo's answer is great, I would just like to add some perspectives (at least in the commutative case) that can possibly shed some more light on the subject. To begin with, it is obvious that if $x$ is an element of a (commutative) ring $R$ and $a$ and $b$ are multiples of $x$ then certainly $a + b$ is a multiple of $x$, and likewise if $a$ is a multiple of $x$ and $b$ is any element then $ab$ is a multiple of $x$. This means that the set of multiples of $x$ is closed under addition and multiplication by any element of the ring. This precisely means that this set is an Ideal, namely, the principal ideal generated by $x$. Now, we can see the defining properties of an ideal as an axiomatization of the notion of "a set of multiples of something" without reference to that mysterious "something". In PIDs, every such ideal is indeed a set of multiples of an element of the ring, but in more general rings, there are non principal ideals which informally correspond to multiples of an "ideal element" which is just a metaphor and not a real element of the ring. One adventage of this concept comes for the observation that ideal elements have "GCD". if $a$ and $b$ are elements of a PID (for example $\mathbb{Z}$) then the ideal generated by $a$ and $b$ is precisely the principle ideal generated by their greatest common divisor. But in more general rings, this may not be a principal ideal at all (equivalently, $a$ and $b$ don't have a greatest common divisor), and in this situation we can still think of it as the ideal generated by the "ideal number" corresponding to what should be the GCD of $a$ and $b$.

OK, so what are prime ideals then? naturally those are the "ideal number" analogies of prime numbers. In some important rings for number theory (algebraic number rings or dedekind domain is general) you don't have unique factorization for numbers but you do have unique factorization for "iedal numbers" into "prime ideal numbers".

I would like to add that even though I belive this is the historical intuition and a good one to have in mind, it is the "arithmetically minded" one. the concept of ideals and prime ideals is fundamental in general commutative rings which are very different from those you encounter in classic algebraic number theory and in particular, higher dimensional ones (whatever that means). It is important to observe that there is another and quite different intuition behind the idea of ideals. for a ring of functions from some geometric object to a field, the set of functions vanishing on a specific point, is an ideal (check this!). the notion of prime ideals can also be reached through the search for a suitable reconstruction of the "points" of the geometric object on which we would like to think the elements of our abstract ring act as functions. The ultimate result of this philosophy and the unification of it with the arithmetic one is the modern approach to algebraic-geometry via the notion of schemes.