First, take a look at letters for consonants. Basic letters for consonants were designed by looking after the shape of the speech organ which plays a central role in pronouncing the consonant.
Basic Consonant Letters Shape of speech organ
5 sounds(賟錼)  
The shape of back of tonguetouching
the velum(soft roof of the mouth)
velar sound
The shape of the tip
of tongue touching the alveola
lingual sound
The shape that the lips firmly closing labial sound
The shape of a tooth
dental sound
The shape of the throat guttural sound

Other consonant letters were made on the base of these 5 basic letters. For exmple, consonants /之/and /中/ are pronounced using the same speech organ at the same location in the mouth, while /之/ is stronger than /中/. Reflecting this fact, the letter for /之/ was made by adding one more stroke to the letter for /中/. This principle is also applied to the relationship between /仃/ and /仆/, /今/ and /元/, or /仄/ and /冗/.

In Korean, some consonants are classified into the tertiary scheme of plain sounds, aspirated sounds and glottalized sounds. /丑/, /之/, /仆/, /今/ and /元/ are plain sounds, and /六/, /兮/, /公/ and /內/ are aspirated sounds, while /丐/, /尹/, /仇/, /介/ and /允/ belong to tensed sounds.

   As can be seen from these, consonats pronounced by the same speech organ at the same location have similar shapes, and the relationship between sounds is parallel to that between letters for these sounds. Adding one stroke to the letter for a plain sound makes it the letter for the corresponding aspirated sound, and putting two identical letters for a plain sound together side by side leads to the letter for a tensed sound.
Plain sounds
Tensed sounds
Summarizing principles of forming letters for consonants, the basic letters were made in imitation of the shape of speech organs, and the others were made by adding a stroke to the basic letters while considering the similarity between sounds and their strength. There is no doubt that the scholars in the King Sejong era were great linguists who exactly analyzed and understood the Korean language of that period. They knew what sounds were there, and understood how the sounds were distinguished.

They decided letter shapes carefully to let the relationship between letters reflect the relationship between sounds. And they had an knowledge on which speech organ played a central role in pronouncing each consonant and what each speech organ looked like. It is a wonder how these were possible in that time, where there was no high-technology method such as X-ray.