Alternative proof of $I$ maximal implies $I$ prime
Your goal is to prove that, when $I$ is maximal, $ab\in I$ implies that either $a\in I$ or $b\in I$. Note that this is equivalent to proving that $ab\in I$ and $a\notin I$ implies $b\in I$.
If $ab\in I$ and $a\notin I$, then $I+(a)=R$ and hence there is some $r\in R$ and $i\in I$ such that $i+ra=1$ (you've already noticed this). Multiplying by $b$, $$ib+rab=b.$$ $I$ is an ideal and $i\in I$, so that $ib\in I$, and we also have $ab\in I$ by assumption. Therefore, we can conclude that $ib+rab=b\in I$.
Let $I\subset R$ be a maximal ideal. Suppose $ab\in I$ yet $a,b\notin I$. Then $I+(a)=I+(b)=R$, so $$R=(I+(a))\cdot (I+(b))=I^2+I\cdot (a)+I\cdot (b)+(a)\cdot (b)\subseteq I+(ab)=I$$ a contradiction, hence either $a$ or $b$ is in $I$ thus $I$ is prime.
The proof that you seek works more generally and it is highly instructive to present it this way. Notice that an ideal $\rm\:P\:$ is prime iff its complement $\rm\:\overline P\:$ is a monoid, i.e. $\rm\:a,b\not\in P\:\Rightarrow\:ab\not\in P.\:$ Krull discovered a very useful generalization of this primality test, namely $(3)$ below, which states that prime ideals are precisely the ideals that are maximal in the complement of some multiplicative submonoid M of the ring, i.e. ideals maximal w.r.t. not meeting M.
Theorem $\ $ TFAE for an ideal $\rm\:P\:$ in a ring $\rm\:R.$
$\rm(1)\ \ \:P\:$ is prime.
$\rm(2)\ \ \:\overline P\:$ is a submonoid $\rm\:M\:$ of $\rm\:R\:$$ $ (where $\rm\:\overline S := R\backslash S = $ set-theoretic complement of $\rm\:S\:$ in $\rm\:R)$
$\rm(3)\ \ \: P\:$ is an ideal maximal in $\rm\:\overline M\:$ for a monoid $\rm\:M\subseteq \left<R,*\right>,\:$ i.e. ideal $\rm\:I\supsetneq P\Rightarrow I\cap M\ne \{\ \}$
Proof $\ (1 \Rightarrow 2)\ $ Since $\rm\:P\:$ is prime, $\rm\:a,b\not\in P\:\Rightarrow\:ab\not\in P,\:$ i.e. $\rm\:a,b\in \overline P\:\Rightarrow\:ab\in \overline P.\:$ Furthermore $\rm\:1\in \overline P,\:$ hence $\rm\:\overline P\:$ is a submonoid of $\rm\:M.$
$(2\Rightarrow 3)\ $ Let $\rm\: M = \overline P.$
$(3\Rightarrow 1)\ $ Assume $\rm\:a,b\not\in P.\:$ Then $\rm\:P + (a)\supsetneq P\:$ so it meets $\rm\:M,\:$ i.e. $\rm\ m = p + a\:\!r\in M,\ p\in P.\:$ Similarly $\rm\:P + (b)\supsetneq P\:$ $\Rightarrow$ $\rm\: m' = p'+b\:\!r'\in M,\ p'\in P.\:$ Therefore
$$\rm\ \ \ ab\in P\ \Rightarrow\ mm' = (p+a\:\!r)(p'+b\:\!r') \in P \cap M = \{\ \}\ \Rightarrow\Leftarrow$$
So, having proved $\rm\:ab\not\in P\:$ when $\rm\:a,b\not\in P,\:$ we deduce that $\rm\:P\:$ is prime. $\ \ $ QED
Your result is simply the special case $\rm\:M = \{1\},\:$ since $\rm\:P\:$ is maximal in $\rm\:\overline{\{1\}}\:$ iff $\rm\:P\:$ is maximal. Notice, in particular, that the proofs in the other answers are essentially the same as the proof above of $(3\Rightarrow 1)$ for the special case $\rm\:M = \{1\}.$ But the proof for general $\rm\:M\:$ is no more difficult. Further, this view is well-worth knowing, since it lends insight into the essence of that matter.
Krull's criterion is useful because any ideal disjoint from a monoid $\rm\:M\:$ can, by Zorn's Lemma, be expanded to one maximally so. This yields a frequently useful method for contructing prime ideals. The essence of the matter is clarified when one studies local-global methods, in particular the important technique of localization, e.g see here and see here. From this viewpoint, the ideals in $(3)$ are simply ideals that extend to maximal ideals in the localization $\rm\:M^{-1} R,\:$ and their primality follows from general principles.
The two proofs so far are either for commutative rings with unity, or for the notion of "completely prime" as opposed to prime. Here's a proof that holds in more generality.
Recall that in a not-necessarily-commutative ring $R$, the definition of prime ideal is that $I$ is a prime ideal if and only if $I\neq R$, and for any ideals $\mathfrak{A}$ and $\mathfrak{B}$, $\mathfrak{AB}\subseteq I$ implies $\mathfrak{A}\subseteq I$ or $\mathfrak{B}\subseteq I$. This is a weaker condition that "completely prime" (the element-wise version); for example, in the ring of $n\times n$, $n\gt 1$, matrices over a field $F$, the trivial ideal $(0)$ is prime, but not completely prime (since we can have $a,b\in R$ with $ab=0$ but $a\neq 0\neq b$). But every completely prime ideal is necessarily prime. In commutative rings with unity, the two notions coincide.
The proof is very similar to Alex Becker's computation.
Theorem. Let $R$ be a ring, not necessarily commutative, not necessarily with unity, such that $R^2$ is not contained in any maximal ideal of $R$ (in particular, this holds if $R$ has a unity). If $\mathfrak{M}$ is a maximal ideal of $R$, then $\mathfrak{M}$ is a prime ideal of $R$. Conversely, if $R^2$ is contained in a maximal ideal $\mathfrak{N}$, then $\mathfrak{N}$ is not prime.
Proof. Assume $R^2$ is not contained in any maximal ideal, and let $\mathfrak{M}$ be maximal in $R$. Let $\mathfrak{A},\mathfrak{B}$ be two ideals of $R$ that are not contained in $\mathfrak{M}$; we prove that $\mathfrak{AB}\not\subseteq \mathfrak{M}$.
Since $\mathfrak{M}$ is maximal, and $\mathfrak{A},\mathfrak{B}\not\subseteq \mathfrak{M}$, then $\mathfrak{A}+\mathfrak{M}=\mathfrak{B}+\mathfrak{M}=R$. If $\mathfrak{AB}\subseteq \mathfrak{M}$, then we have: $$\begin{align*} R^2 &= (\mathfrak{A}+\mathfrak{M})(\mathfrak{B}+\mathfrak{M}) \\ &=\mathfrak{AB}+\mathfrak{AM} + \mathfrak{MB}+\mathfrak{M}^2\\ &\subseteq \mathfrak{AB}+\mathfrak{M}\\ &\subseteq \mathfrak{M}+\mathfrak{M}\\ &=\mathfrak{M}. \end{align*}$$ But this contradicts our assumption that $R^2$ is not contained in any maximal ideal; therefore, $\mathfrak{AB}\not\subseteq \mathfrak{M}$, as desired.
If $\mathfrak{N}$ is a maximal ideal that contains $R^2$, then $\mathfrak{A}=\mathfrak{B}=R$ are a witness to the non-primality of $\mathfrak{N}$. $\Box$
If we assume $R^2=R$ (instead of simply that $R^2$ is not contained in any maximal ideal of $R$), then the proof can be done directly, instead of as by contradiction, by showing that $\mathfrak{AB}+\mathfrak{M}=R$.
For an example where $R^2\neq R$ but we still have that the implication holds (vacuously), take $R=\mathbb{Q}$ with zero multiplication. Then ideals corresponds to subgroups, and since $\mathbb{Q}$ has no maximal subgroups, it is still true that every maximal ideal is also a prime ideal.