Excerpted and adapted from a shiur by Harav Chaim Weg
May 21, 2020
You shall count them by their legions, you and Aharon.
According to the Ramban, the Torah here uses the term “pekidah” for counting rather than “sefirah” to indicate that B’nei Yisrael should not be counted directly but through machatzis hashekel coins. It seems that the Ramban holds it is Biblically prohibited to count the Jewish People directly. The Gemara in Berachos 62b also implies it’s assur mid’Oraisa when it says that David Hamelech erred in counting the people (in Shmuel Bais 24:1-2), something even schoolchildren know is forbidden. This is the opinion of a number of mefarshim, including Tosfos Rid (Yoma 22b) and Rashi (Ki Sisa).
But the Gemara in Yoma 22b quotes a number of pesukim in Navi to prove that it is forbidden, which indicates that it is only prohibited midivrei kabbalah (based on the Nevi’im). The Rambam (Hilchos Temidin Umusafin 4:4) also says it is forbidden to count Jews directly based on pesukim in Navi, and it is only permitted if done indirectly, such as when the kohanim extended their fingers for the daily lottery.
Either way, how did David Hamelech rationalize counting the people? The Ramban explains (in Ki Sisa) that David thought the mitzvah did not apply to future generations. The Ramban (here) suggests alternatively that either David used shekalim for the count but counted unnecessarily, which is also forbidden, or he only counted those over twenty, whereas the prohibition only applies when counting all Jews. According to Tosfos Rid (Yoma 22b), the prohibition applies even when counting with shekalim unless it is done for a d’var mitzvah.