Bemidbar17:10 records that G-d told Moshe that he and Aharon should separate from the people since G-d was about to kill the people who had accused Moshe and Aharon of killing the 250 men (17:6), and the end of 17:10 records that Moshe and Aharon fell on their faces when they heard this threat. I think that G-d did not really intend to kill all the people since then G-d would have killed the people without speaking to Moshe. (This same point can be made in other cases where G-d threatened to kill the people, as for example, after the sin of the golden calf, Shemot 32:10, after the sin of the spies, Bemidbar 14:12, and in the previous chapter, 16:21.) Moshe understood that something could be done to save the people, and then Moshe sent out Aharon to walk between the people with an incense pan to stop the plague that had started to kill the people, 17:11-15.
How did Moshe know that Aharon should take an incense pan and walk amongst the people? Why did he choose this action instead of praying as he did by the sin of the golden calf and by the sin of the spies?
One possibility is the G-d gave the instructions to Moshe to tell Aharon to take the incense pan when Moshe fell on his faces. In a similar situation in the beginning of Korah’s rebellion, when Moshe fell on his face, 16:4, the Rashbam (on 16:4) makes the suggestion that when Moshe fell on his face, G-d gave Moshe instructions what to say to Korah. If G-d did speak to Moshe on that occasion, then here too G-d could have spoken to Moshe when Moshe fell on his face. However, in both cases there is no indication in the Torah that G-d spoke to Moshe when Moshe fell on his face.
Rashi (on 17:11) quotes a second possibility from the Talmud (Shabbat 89a) that when Moshe was on Mount Sinai the angel of death told him that the incense could stop a plague. The Talmud ends that if
this was not true, then how could Moshe have known that the incense would stop the plague?
My guess is that Moshe deduced this information by the first stage of Korah's revolt. 16:21 records that G-d told Moshe and Aharon to remove themselves from the 250 men who had come to do the test of fire pans since G-d was about to kill them. 16:25 then records that Moshe left, but it is not recorded that Aharon left, and according to 16:17 he was supposed to stay with the 250 men since he was part of the test of the fire pans. How then was Aharon protected if he did not leave? Did he have immunity since he was the high priest? This could be, but his two sons, Nadav and Avihu did not have immunity (Vayikra 10:2) and 16:21 and 17:10 imply that he did not have immunity, though maybe one could argue that these were not real threats. Yet, even these if these cases were not real threats, still the basis for the possible threat is that if a plague goes out from G-d then even the innocents can be killed, see Rashi on Shemot 12:22.
If Aharon did not have immunity, how did he survive the fire that went out and killed the 250 men? It must be that when he brought his incense as part of the test of the 250 men, the incense gave him immunity from the fire that killed the 250 men. This would be similar to the incense that protects the high priest when he goes in the Holy of Holies, the inner room of the mishkan on Yom Kippur, Vayikra 16:2,13. Why then did G-d have to tell Aharon and Moshe to separate from the rebels prior to the incense test in 16:21, if he had this protection? It could be that G-d was just threatening Moshe and Aharon to get Moshe to act or it could be that Aharon had not yet lit the incense so he did not yet have this protection from the incense. In any event, from the fact that Aharon was with the 250 men but was saved when the 250 men died, 16:35, Moshe realized that the incense, if brought correctly, could protect a person from danger, and hence he knew to instruct Aharon to walk through the people with the incense to stop the plague.