Prince Harry probably had less luck than Han Solo speaking to Chewbacca (© Adrian Dennis-WPA Pool/Getty IMages)
The same way that the early explorers and missionaries learnt the native languages of Southeast Asia and South America. You begin with pointing and other gestures, and slowly build from there.
Children younger than five are much better at this than older kids and adults, so we could train a generation of interpreters by raising children in a mixed human and alien environment.
If the aliens were particularly strange, we might not actually be able to speak their language at all. Han Solo and Chewbacca can understand each other, but Han never speaks a word of Wookiee.