Bamidbar 1:51 – When the Tabernacle is set to travel, the Levites shall dismantle it; and when the Tabernacle camps, the Levites shall erect it; any outsider [non Levite] who approaches shall be put to death.
Gemora Shabbos 31a – A non-Jew asked Hillel, “Who does this verse refer to? Hillel responded: Even to King David”
Torah Temimah Colloquial Translation on Note #2:
The Gemora here mentions this story as a continuation of the story of the non-Jew who approached Hillel and asked to be converted on the condition that he be appointed as the High Priest. Hillel responded, “first go and learn the whole Torah.”
The non-Jew went and studied and when he reached this verse he asked what type of ‘stranger’ the verse is referring to. Hillel responded that this law regarding non-Levites [a type of hereditary priesthood] applies even to King David.
The reason for Hillel’s mentioning King David is multi-fold. First of all, perhaps this is an allusion to the Gemora Kritot (6b) where it discussed the verse in Ki Tissa regarding forbidding ‘strangers’ from deriving benefit from the anointing oil in the temple. In that particular situation the word ‘stranger’ does not apply to a King because, actually, a King is one of the people who is anointed with that oil. Nevertheless, here, however, Hillel wanted to emphasize that the word ‘stranger’ would apply to any non-Priest.
An additional reason for mentioning King David is because of the fact that King David is descended from converts [from Ruth the Moabite]. Even though it is well known that converts are especially beloved before God and even though he is King, still this verse’s severe punishment for a stranger applies even to him. Therefore, the implication is that Hillel was obliquely telling the convert that he has no chance of becoming High Priest [but that this doesn’t indicate that he is any less beloved or of a low stature.]
It is also possible that Hillel decision to choose King David as an example is a reference to the verse in Chronicles (15:2) “Thus said David that only the Levites will carry the Ark of the Lord because God has specifically chosen them for this task…”
Thus we see that King David himself was aware not to participate in a service that had been assigned to the Levites and certainly would have not desired to participate in a service assigned to the High Priest.
Editor’s Note: The idea that the law forbids someone who is not descended from the Cohanim to officiate in the temple is not meant to be an insult or any lack of stature for the non-Priest. In fact, the Torah teaches that there are 3 crowns: the crown of Priesthood, the crown of Kingship and the crown of Torah; the crown of Torah being the greatest one of all.
Additionally, for me, the message is that we are all strangers, in one way or another.