Neither Joseph, Mary, nor Jesus were ILLEGAL immigrants. Egypt had exceptionally harsh penalties for those who entered their territory without permission.
We celebrate Christmas in a few weeks when Mary and Joseph traveled to Bethlehem to register with the government as required by law. They obeyed the law as did Jesus. Jesus’s enemy was not the government, it was the existing church leadership.