Orthography is more about disseminating communication in an asynchronous way than pronunciation. Over time, it crystallises into something most people can agree on and use to communicate; however, in that time, it will pick up relics that are hard to get rid of. It is also true that while it reaches a relatively stable point, it still evolves slowly (e.g., in texts from about 100 years ago, you sometimes see "cooperate" spelled "coöperate"; in really old texts, you'll see the "long s", like in "highneſs").
The main point is that writing is a human invention, while language itself is thought by most to be a natural cognitive facility, similar to face recognition, that we've evolved to survive and flourish. When a spelling was coined for a particular word, chances are that it was relatively close to its pronunciation at the time, but oral language changes faster than written tradition.