Mary anticipates of the birth of her son as she and Joseph prepare to go to Bethlehem for the Roman Census.
To put this event into context, check the timeline of the events of that first Christmas.
The area of Syria and Judaea was a province under the peaceful rule of the Emperor Augustus’ Pax Romana. Augustus ruled by way of local Kings, in this case Herod the Great, and governors. Luke writes that in this case that was Publius Sulpicius Quirinius.
The correctness of Luke’s account is debated (elsewhere it is written that Quirinius was governor only after Herod’s death), which is one of the many problems in the dating of the year of Christ’s birth.
When Mary was pregnant, Luke writes, Quirinius ordered a Census for the purpose of taxation. Mary and her husband Joseph had to travel from their home in Nazareth, Galilee, to Bethlehem in Judea, the place of Joseph’s ancestors. In the Old Testament, the city of Bethlehem is identified as the birth-place of "Him whose goings forth have been of old" (Micah 5:2).
On 18 December some Roman Catholic Churches hold the Feast of the Expectation of Our Lady, celebrating Mary’s joyful anticipation of the birth of her child as she and Joseph got ready for their journey.
They arrived when Mary was near term. The story, from Luke, goes that they could not find room at the inn and that they were forced to retire to a humble manger or stable. This is where Jesus was born.