Is it necessary for bishops and popes to be priests first?
Yes. Bishops are priests, they simply receive the sacrament of holy orders to the fullest degree when ordained to the episcopacy. Bishop Fulton Sheen once revealed that when he was a priest, he would pray three Hail Marys a day that he be made a bishop – not because he wanted the responsibilities or the prestige of the episcopacy, but because he wanted to realize the fullness of his vocation to the priesthood.
As for popes, theoretically speaking, any baptized male Catholic can be elected to the papacy. However, if the man elected is not already a bishop, he must be ordained a bishop before he can become pope because the pope is the Bishop of Rome.