Map of Korea during the Korean War
The 38th parallel divided the Korean peninsula from 1896 unofficially.
Only after the World War II, Korea was divided in 1945. On 25th June 1950, the North Koreans invaded, crossing the 38th parallel. Even the current demilitarized zone roughly follows the 38th parallel, slightly north to it.