Yugoslavia took a very pragmatic approach to foreign policy, and in regards to North Korea this was no exception. In 1950, the Yugoslav Foreign Minister Edvard Kardelj even went so far as to condemn North Korean aggression on the south. The country ultimately took a line supporting a demarcation line at the 38th parallel and U.N. action in Korea, an uncomfortable position for a socialist country to be in considering the role of the United States in the Korean War (pg. 65-66, Tito's Yugoslavia by Duncan Wilson).
Both Yugoslavia and North Korea were part of the Non-Aligned Movement, whose founding was in Belgrade with Tito's Yugoslavia being one of the founding members. They were both 'communist' regimes that had not 'picked a side' during the Sino-Soviet split.
Their relations were generally good, with Tito prominently visiting North Korea in 1977. Yugoslavia eventually established relations with South Korea in 1990, much to the chagrin of the North Koreans.
A North Korean song about Tito https://www.youtube.com/watch?v=dU53KD1DB8Y
August visit to North Korea in 1977 https://www.youtube.com/watch?v=ytwNt-UkfeQ
Hope you enjoy the videos!
http://osaarchivum.org/files/holdings/300/8/3/text/37-8-432.shtml Report prepared by RFE describing relations between the two countries in the wake of Tito's visit to North Korea in 1977, pictured in the video above.
For sources on relations extending into the 21st century with Yugoslavia / Serbia, check out the North Korea Handbook prepared by the Yonhap News Agency. It details important agreements signed between the countries in more modern times.
when? why? need a little bit more info to actually give you an answer.