Men are ordained to the Melchizedek Priesthood because of their faith and good works in the premortal existence.
1 And again, my brethren, I would cite your minds forward to the time when the Lord God gave these commandments unto his children; and I would that ye should remember that the Lord God ordained priests, after his holy order, which was after the order of his Son, to teach these things unto the people.
2 And those priests were ordained after the order of his Son, in a manner that thereby the people might know in what manner to look forward to his Son for redemption.
3 And this is the manner after which they were ordained—being called and prepared from the foundation of the world according to the foreknowledge of God, on account of their exceeding faith and good works; in the first place being left to choose good or evil; therefore they having chosen good, and exercising exceedingly great faith, are called with a holy calling, yea, with that holy calling which was prepared with, and according to, a preparatory redemption for such.
4 And thus they have been called to this holy calling on account of their faith, while others would reject the Spirit of God on account of the hardness of their hearts and blindness of their minds, while, if it had not been for this they might have had as great privilege as their brethren.
5 Or in fine, in the first place they were on the same standing with their brethren; thus this holy calling being prepared from the foundation of the world for such as would not harden their hearts, being in and through the atonement of the Only Begotten Son, who was prepared— . . .
10 Now, as I said concerning the holy order, or this high priesthood, there were many who were ordained and became high priests of God; and it was on account of their exceeding faith and repentance, and their righteousness before God, they choosing to repent and work righteousness rather than to perish.
Elder Bruce R. McConkie wrote:
“Alma says that those ‘ordained unto the high priesthood of the holy order of God’ were ‘in the first place,’ that is in pre-existence, ‘on the same standing with their brethren,’ meaning that initially all had equal opportunity to progress through righteousness. But while yet in the eternal worlds, certain of the offspring of God, ‘having chosen good, and exercising exceeding great faith,’ were as a consequence ‘called and prepared from the foundation of the world according to the foreknowledge of God’ to enjoy the blessings and powers of the priesthood. These priesthood calls were made ‘from the foundation of the world,’ or in other words faithful men held priesthood power and authority first in pre-existence and then again on earth.”
(Mormon Doctrine, 2nd ed. , 477.)