The short answer is "no". It is not, strictlly, necessary and
there have been many examples in history when ordination to the
priesthood or episcopacy has happened directly from the lay state.
It has, however, been a long-established custom for ordination to
the diaconate to be normative before ordination as a priest.