The census was conducted counting males from the age of 20 and up. These are the ones who then had to contribute a half-shekel of silver each year to the kohanim. These funds were then used to purchase the animals and other necessities for the communal sacrifices. (A shekel was 20 gera, so a half-shekel was 10 gera. This was probably about 6 grams of silver, or about .2 Troy ounces. In today’s prices, it would probably be about $5 a head.)
The purpose underlying this mitzvah is that everyone in the community should have a share in the communal service of the Temple. Every family shared in the merit of supporting the service of God on behalf of the nation. This was a flat fee that everyone, rich or poor, had to give equally so that all were equal in terms of this mitzvah. (Of course, one could give more, but that would not affect the performance of giving the annual half-shekel.) In essence, it was very much like our synagogue dues are today. Yes, there are some who may voluntarily give more but every family is assessed a certain fee to keep the place going. If we don’t give none, there won’t be none.
Every male over the age of 20 gave the half-shekel in one lump-sum payment. This included not only born Jews, but also converts and freed slaves. Women and minors were exempt but if they voluntarily gave, their donation was accepted. While non-Jews were welcome to bring sacrifices at the Temple, they were not permitted to make this particular donation as they had no share in the communal offerings of the Jews. If someone paid with money other than the prescribed silver half-shekel, they had to add on a small charge to pay the money-changer, since it had to be converted into silver half-shekels.
This mitzvah applies at a time when the Temple is standing. If someone neglected to give it, he was not considered included in the communal offerings, nor in the atonement they bring. The half-shekel was given in the month of Adar; nowadays we read the portion of the half-shekel and we have the practice to donate a half-unit of the local currency.
The obligation to give the half-shekel is the subject of the Talmudic tractate of Shekalim and codified in the Mishneh Torah in Hilchos Shekalim. It is #171 of the 248 positive mitzvos in the Rambam’s Sefer HaMitzvos.