From where does the tradition come that Mary rode on a donkey to Bethlehem prior to the birth of Jesus? It seems that most every movie or depiction of Mary and Joseph on the way to Bethlehem depicts Mary as riding on a donkey.  However, I don't recall any place in Scripture from which this idea could be founded.  The only place where the trip is mentioned in in Luke:


  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, 5 to be registered with Mary, his betrothed, who was with child.  Luke 2:4-5


So, is there any source for why this is assumed almost universally or any particular reason?  It seems that she could have just as well walked or ridden a camel.
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.
Protoevangelium of James:17

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.