I restarted watching Doctor Who from the beginning, but I think I may have missed something and it's made me wonder if they ever explain, during the Marco Polo episodes, for example, how is it possible for the main group of characters, with the exception of the Doctor, to understand Tegana and the other Asian characters?
In the words of the Doctor, it's a "gift of the TARDIS, a telepathic field that gets inside your brain — translates."
The TARDIS creates a psychic bond with everyone who travels in it, by which said person instantly and effortlessly can understand (almost) any language they encounter, and automatically speaks the correct language back to everyone they meet. On the other hand, the Doctor has also said in the past that's it's a gift of the Time Lord that he grants to his companions; that it seems to be related to both him and the TARDIS suggests to me that it's actually somewhere in between, that it's a function of the two of them together.
Of course, sometimes the TARDIS seems to do it for non-travelers as well, and other times (most notably Clara's first trip) it seems to be a bit testy about who it will give the gift to, or how "complete" the understanding actually is; out-of-universe this is lazy writing and/or deliberately done for dramatic/humorous effect, but in-universe it's just because the TARDIS doesn't like you, or is just having a spot o' fun at your expense. Sometimes too the translation circuit simply fails altogether. Other times it seems to just like messing with you, like when Donna was heard by a local as speaking Celtic when she spoke actual Latin while in ancient Pompeii ("The Fires of Pompeii").
Note that the gift is not limited by distance from the TARDIS, either in space or in time (except when it is), although companions who cease to travel with the Doctor seem to lose it at some arbitrary point. Also note that some languages are simply "not translatable", e.g. written Gallifreyan.