One of the near certainties in science fiction movies and TV shows that have aliens in them, is that the aliens almost always speak English. The reason for that is that it's simpler that way. There is only so much time to tell a story in a movie. An episode in a TV series is even more limited, since it has to fit in a pre-defined time slot. For most of TV history, TV series were episodic in nature, and if there needs to be communications between humans and aliens, "the other", then we don't want all stories to be about learning to speak a new language. This means the aliens need to be able to communicate with us and we need to apply some willing suspension of disbelief.
Usually some throw-away explanation is given. If the aliens come to Earth, then they might have spent years studying our transmissions. In other instances, some translation mechanism is mentioned. In the Doctor Who episode "The Masque of Mandragora" the Doctor explains that understanding other languages is a Timelord gift that he shares with his companions. In the newer series they play with that a bit. In the Christmas Invasion, when it seems the Doctor isn't going to make it through the regeneration, just before tea saves the day, Rose, his companion, loses the ability, and when the Doctor wakes, she gains it again. In "The Fires of Pompeii", Donna, the Doctor's companion at the time, tries some Latin words when speaking to a Roman, and he hears them as Briton words which he doesn't understand. An odd choice, since English was certainly not a dominant language in the British isles in the first century, although this is really a self-parody on the concept. In later episodes the Doctor claims that he can "speak baby."
That seems like a natural extension of the concept of universal translation, however it brings up an interesting question – in a society where universal translation exists, if babies can communicate with everyone by "speaking baby," why would they need to learn a language?
In Star Trek, ever since the very first series, there were often mentions of the universal translator. The concept is even mentioned in Gene Roddenberry's original pitch.
The original pitch is interesting not just because of the language issue. This document provides an in-universe explanation as to why other planets seem similar to Earth, or to some aspect of Earth or Earth history, and ties that in to the ability to use existing sets and consequently cut on expenses. It's also the source of the "Wagon Train" reference which is often used to "prove" that the show was pitched as a space western. However, the quote as it's usually presented is actually a mis-quote taken out of context. When reading the entire pitch, even the entire paragraph, it's obvious that the space western concept simply isn't there.
It's never made clear how the universal translator works, and the few statements made about it don't seem to be supported by what is actually seen in other episodes. In "The Man Trap" Uhura is surprised when a crewman, speaks to her in Swahili. What is unknown to her at the time is that it's actually an alien who can change its appearance. In "Spectre of the Gun" each member of the Bridge crew hears a warning in their own native language – either that should be the normal function of the universal translator, or it should translate all of those languages into English. The fact that Kirk comments that he hears the warning in English is itself unusual, since that's what he's supposed to expect. In "Bread and Circuses" they arrive at a planet and Spock discovers that it's "A complete Earth parallel. The Language is English." The Earth parallel concept is not mentioned in many episodes, but it's directly from the original pitch. With the universal translator, they shouldn't care what the language is. However, there is a minor plot point that depends on this. So minor, they could have done without it.
In Star Trek: The Next Generation things get even more complicated. In ST:TNG, one of the regulars, Worf, is a Klingon, and there are a few stories, even some arc, that have to do with the his family, his culture, and even the politics of the Klingon Empire. When Klingons are involved, they will sometimes use Klingon words and phrases. These are used as ethnic markers, in the same way immigrants and foreigners in movies often use common words from their native language even when they speak English. Usually words like yes,no, hello, thank you. Somehow the universal translator knows when not to translate Klingon.
The only Star Trek episode which deals with language barriers is Darmok. I've read quite a few criticisms of Darmok. My own translator's view of Darmok somewhat differs from the linguists criticisms I've read, and it deserves its own post. ( and here it is: The Language of Darmok – a Translator's View)
In the prequel series, Enterprise, they used an earlier version of the universal translator. At first there were instances where it didn't work quite as well as the later version. It didn't take long before the only reference to it being an early model was that new aliens sounded at first as if they talk gibberish, and after a moment or so the translator picked up the language and it started sounding like English.
The various incarnations of Stargate had different ways of dealing with language. In the original Stargate movie the Stargate took the team to a planet where humans, probably descendants of early Egyptians, lived, and were kept backwards by the evil alien who ruled them. The locals had no common language with the Earth explorers. Only Jackson, the archaeologist identified some words and managed some limited communications with them.
In Stargate:SG1, the TV series, some of the original team members go back there, and suddenly everyone speaks perfect English. In fact, in every planet they go to, every one, no matter which historic Earth culture they're descended from, speaks perfect English. In Stargate: Atlantis the situation became even stranger. The expedition is a multinational expedition. So many of the expedition members, speak English with an accent. The people they encounter on other planets (and that show takes place in another galaxy) all speak perfect American English. That's right, the non-Earth people speak better English than some of the Earth people. In Stargate:Universe they end up very far away, there are fewer encounters with aliens, and there is little communication with them.
Automatic universal translation is a useful trope. However when examined too closely, it rarely holds up. Just accept whatever throw-away explanation is given. Suspend your disbelief. Don't think about it too hard.