No, the continuous assumption is not necessary. As pointed out by others in the comments, the essential reason is the derivative satisfies the intermediate value property. If $f'$ takes value $a,b$ and $a<b$ at an interval, then $f'$ would have to take any value $c$ between $(a,b)$.
A heuristic way to think about it might be as follows: by elementary arguments you would have
$$
f(c)-f(d)=\int^{c}_{d}f'(t)dt\le (c-d)\max_{t\in [c,d]} f'(t)
$$
and by analogous arguments $$
(c-d)\min_{t\in [c,d]}f'(t)\le f(c)-f(d)\le (c-d)\max_{t\in [c,d]} f'(t), c>d
$$
Therefore by intermediate value property there must be some element $e\in [c,d]$ such that $$(c-d)f'(e)=f(c)-f(d)\leftrightarrow f'(e)=\frac{f(c)-f(d)}{c-d}$$ and this is the mean value theorem. This is only heuristic because we assumed maximum and minimum exist for $f'$ on $[c,d]$, which is not necessary, but I hope the geometry is clear. The usual (rigorous) proof goes by constructing an ancillary function $h(t)=(f(c)-f(d))t-(c-d)f(t)$ and apply Rolle's theorem.
Some related discussions can be found at here (but might be too technical and not really related to the question you are concerning at this point):
Discontinuous derivative.
How discontinuous can a derivative be?