The Protoevangelium of James, an apocryphal Gospel probably written about AD 145, Says that Joseph used a donkey to bring Mary to Bethlehem
The day of the Lord shall itself bring it to pass as the Lord will. And he saddled the ass, and set her upon it; and his son led it, and Joseph followed.
So we know, that from very early times, Christians had the image of Mary riding a donkey to Bethlehem before Christmas.
Why not walking?
The distance from Nazareth to Bethlehem is 70-80 miles. A fit man can travel perhaps 20 miles a day. Normally it would take about 4 days to travel from Nazareth to Bethlehem (assuming travel only during day time). Some Christians say that Joseph was a older man, and also as per tradition Mary was heavily pregnant and so she could not walk this long distance. There is fear of miscarriage too. This makes the journey longer than normal.
Samaria lay between Galilee and Judea which had Bethlehem in it.See map There was much ill feeling between the Samaritans and the Jews.John 4:9 Any lone traveler crossing from Galilee into Samaria would be at risk of not receiving any lodgings or any other type of assistance on the journey. The family would have had to travel east, cross over into modern-day Jordan and then travel south on the eastern side of the Jordan River, before crossing back into Judea. This makes the journey much longer.
Could she have used a different ways of transportation like a camel? Common means of transportation in those times other than walking were donkey (ass), camel, horse, cart drawn by horse or donkey.
I personally don't see a women in her late stages of pregnancy, riding a camel. That would be too difficult. I am not a doctor, but I don't think it would be good for that child too. We also see that people using donkey when they are not in a position to walk like in the parable of the good SamaritanLuke 10:34
Some people say St. Joseph was very poor and could not have afforded a donkey. I personally disagree. St. Joseph was not rich, but he was also not so poor that he could not have afforded to borrow a donkey for his pregnant wife. He was a carpenter, he had a job.
So to answer your question why it is assumed almost universally, I think it is common sense.