This is an idiomatic expression for travelling to Jerusalem and surroundings. Joseph might have owned some fields in Bethlehem as a descendant of David, and therefore, he had to make this journey because the possession of land was a primary source of tax income for the Romans.
4 And Joseph also went up from Galilee, from the town of Nazareth, to Judea, to the city of David, which is called Bethlehem, because he was of the house and lineage of David,