Throughout the world the oath of loyalty to Caesar was taken in the Temples of Augustus at the altars, but, as Josephus often shows, exceptions were always made for the Jews who worshiped only one God. Throughout Herod’s kingdom the people would have enrolled themselves at their local synagogues in the cities in which they lived (Luke 2:3), but Joseph and all those who were “of the house and lineage of David” (Luke 2:4) were an exception to this rule. Joseph and others who might be thought of as laying claim to David’s crown had to register in Bethlehem.
Why would Joseph and Mary be singled out in this respect? Was Caesar afraid of David’s descendants? No, rather, it was Herod who was concerned over them, together with anyone else who might seek to overthrow his command. While all the Jews were registering their oaths of loyalty to Caesar, Herod had them do the same for his own crown, as Josephus points out:
041 There was also a Jewish party called Pharisees, who claimed to set a high value on detailed knowledge of the ancestral laws which are pleasing to God, by whose guidance this circle of women was ruled. This party could have greatly helped the king but were set on opposing and harming him. 042 When all the rest of the Jews swore allegiance to Caesar and the rule of the king, more than six thousand of these men did not swear… (emphasis mine) [JOSEPHUS; Antiquities of the Jews 17.2.4]
Herod was very jealous over his own authority and had many, even among those of his own household, slain when he suspected them of seeking to overthrow him. He, therefore, kept a close eye on those Jews who might want to declare one of David’s descendants as ruler of the land. Josephus tells us that this wasn’t the first oath of allegiance that Herod demanded of the people:
368 Any who in no way could be forced to submit to his rule were prosecuted in various ways, and he required the rest of the people to take an oath of loyalty to him and made them swear an oath of their goodwill and to continue under him as their leader. 369 In fact most people, whether to please him or for fear of him, submitted to his demands, while in one way or another he did away with those of a more generous temper who objected to the compulsion he used on them. (emphasis mine) [JOSEPHUS; Antiquities of the Jews 15.10.4]
Herod delighted in opportunities to find out the mind of the people toward him and to eliminate those whom he thought might be critical of his rule and disturb his will. Therefore, anyone who might assume he was heir to the throne of David, such as Joseph and even Mary, whose genealogy Luke gives us in chapter 3 of his narrative, had to register under the watchful eye of Herod, the king of Judea. He had spies everywhere, and those who didn’t comply to his demands were either tortured or killed—or both. According to Josephus, Herod’s clandestine efforts took such a turn that even he, himself, would dress up as a private citizen from time to time in an effort to discover the Jews’ opinion of his authority. Truly, this man never felt secure in his position, but lived in fear of being removed. Therefore, he constantly kept himself aware of anyone, friend, family or enemy, who might seek to rise up against him, and he spared no means he thought necessary to assure himself of the security of his own position.
 See JOSEPHUS: Antiquities of the Jews 15.10.4 (366-367)