Based on the positions of some characters, they can change sound. This sounds really confusing at first, and to be honest I still don't know most of the sound change rules, but these rules are actually meant to make Korean pronunciation easier!
These weren't actually made as "rules" in the beginning. They were simply what people naturally did when speaking anyway. We have the same types of rules in English too, where we pronounce things differently to make them easier to say.
Most of the rules I know so far I've learned from Korean from Zero!
Here is an extensive summary of Korean pronunciation from /r/Korean.
T-stops
When ㅅ,ㅈ,ㅊ,ㅎ are used as a 받침 (final consonant or consonant cluster) they make a t sound.However, when a T-stop consonant is follow by ㅇ (이응) the T-stop is cancelled.
ㅅ followed by ㅎ
When ㅅ is followed by ㅎ in the next character, the sound moves into the ㅎ position and is pronounced as ㅌ.ㅅ: "s" to "sh"
Briefly mentioned in the 한글 post, if ㅅ is combined with ㅣ, ㅕ,ㅑ, ㅛ, ㅠ the s sound changes to an sh.Otherwise, it remains s.
ㄹ: "l" vs. "r"
When there are two ㄹ back to back, it makes an l sound.When the ㄹ is at the end of a word, it makes an l sound.
When the ㄹ is at the beginning of a word, it makes an r sound.
ㄹ and ㄴ combinations
When ㄹ is follow by ㄴ, or ㄴ is followed by ㄹ, the combined sound changes to a double l sound.Unexpected "ch" sound
When ㄷ is followed by ㅎ, it makes a ch sound.When ㅌ is followed by 이, it makes a ch sound.