In the Bible the Book of Numbers (written around 1428 BCE) is so called because of the two censuses taken of the Israelites. In Chapter 1 God asked Moses to take a census of the whole Israelite community, and identify men who could serve in the army. God repeats the request in Chapter 26.

And, of course, the Romans also conducted a census every five years, calling upon every man and his family to return to his place of birth to be counted, in order to keep track of the population (Luke, Chapter 2). Which is why Jesus was born in a stable in Bethlehem. The census was necessary to help in the administration of an expanding Roman Empire, and to determine taxes.

Mary and Joseph register for the census before Governor Quirinius. Byzantine mosaic c. 1315.