The Oath is designed to be a statement of loyalty to the new country. This ceremony is important because nations want their citizens to be faithful and to uphold the constitution.
Taking an Oath of Allegiance expresses a specific intention, using words like “I swear” or “I solemnly affirm.” When one takes an Oath of Allegiance to their new country the intention is not limited to that moment, it includes the commitment to be loyal while upholding the laws of the nation in future too.
In the United States, at the end of the naturalization process, all immigrants are required to take a public oath of allegiance – not to the president, or even to the United States per se, but to the Constitution.
Oaths of allegiance are commonly required of newly naturalized citizens worldwide, members of the armed forces, and those assuming public office – particularly parliamentary and judicial.
In many Commonwealth states, all that is required is an oath to the monarch, not the constitution or state. There have been attempts to make the oath of citizenship sworn by new citizens refer to the country rather than the monarch. However, the oaths sworn by judges and members of parliament have not been changed as the Queen is the personification of the Canadian, British, or Australian state (or that of any other Commonwealth realm).