It's a good question. It turns out that linguists can discover quite a lot about how some languages were pronounced before audio recording existed. I got some insight into this by reading the first chapter of an academic book on the pronounciation of Latin where there was a summary of the different kinds of evidence that can be used. Unfortunately I don't have the list to hand so the following is just my random brainstorming:
* the pronunciation of descendent languages, especially when there are lots of them, or lots of different dialects
* comparison with languages that have a common ancestor
* how words were transcribed from one language into another
* how words were changed when adopted from one language into another
* what spelling mistakes were made, particularly in cases where the writer was less educated or being less careful, such as graffiti
* rhyme and metre in poetry
* in literature, cases where someone is mocked for their pronunciation
* puns and wordplay in literature
* and of course cases where ancient authors have written more or less explicitly about pronunciation, either descriptively or prescriptively
> * the pronunciation of descendent languages, especially when there are lots of them, or lots of different dialects
It's worth calling this out as being one of the key elements of historical linguistics. Establishing genetic relations between languages requires proposing systematic sound shift laws that can explain why cognates sound the way they do, and this means that cognates in modern languages may not bear much resemblance to each other (English five and Sanscrit pankan are cognate yet share 0 sounds!). For example, there's a rule in the Germanic languages that shifts /k/ to /h/, so words like Latin "centum" instead become English "hundred" or "canis" to "hound" [1].
Now these pronunciation shifts often have caveats in them, such as shifting only before certain kinds of vowels or consonants. These restrictions can give you some clues as to why certain words seem to undergo a change while other words with seemingly similar pronunciations didn't. In Proto-Indo-European, this leads to the notion that there are several consonants (specifically, laryngeals) which are no longer present in any modern Indo-European language but whose existence in the original is responsible for sometimes shifting vowels that otherwise appear somewhat anomalous in descendant languages.
[1] To be clear, Latin is not the initial word and English is not the final word. I'm just using Latin to illustrate a word closer to the original Proto-Indo-European pronunciation and English to illustrate what the Proto-Germanic pronunciation shifts towards.
English orthography is a dead giveaway. For example, why does the letter "i" in most continental European languages represent the vowel /i/, while in English it represents a diphthong? The way French loanwords or Latinisms are pronounced in modern English is similar evidence.
Also, vowel chain shifts are exceedingly common across the languages of the world: compare Tatar and Kazakh to the other languages of their subgroup (Kipchak) within the Turkic family, for instance. Sometimes a vowel chain shift can even be observed in progress, as in the case of the Northern Cities Shift in the USA. [0]