There are several reasons for the UN joining on the side of South Korea during the Korean war. Probably the largest is that the Soviet Union was at the time boycotting the United Nations over the issue of Chinese membership in the United Nations. China had been admitted as a Security Council Member in 1945, crucially while the Republic of China (later Taiwan) was the de jure and de facto government of China. This is also before Suez would splinter the Western faction in the UN (albeit not that much). So in 1950 there was really only the Soviet Union as a permanent member who would have considered a veto. However, the Soviets were currently boycotting the UN over the West's refusal to transfer China's seat to the People's Republic of China (this would occur decades later). This meant no Soviet presence was possible to veto this escalation. The Soviet representative could have, however, ended the boycott. He did not. According to a letter exchange between then Czech president Klement Gottwald and Stalin, Stalin desired a UN intervention in Korea and was content to use the pretext of China to stay out. More on this later.
As for the non-permanent members at the time. (please correct me if I am wrong) They were, in no particular order: Ecuador, Cuba, India, Yugoslavia, Egypt and Norway. At the time, most of these nations were influenced by the United States or United Kingdom, with India and Yugoslavia being notable exceptions. I cannot go too in depth on these two nations' responses, but as they are not permanent security council members, they were not given veto power and were outvoted by the West and its allies. The Soviet Union, who was currently boycotting the UN over the China issue, could thus not veto the actions taken by the UN. Stalin also in private letters as the above mentioned one to Gottwald desired a UN invasion. Stalin did this for three reasons that he outlines. 1) He desired to undermine the US position by dragging them into a, hopefully long, war. 2) He desired to provoke the US and China into a war to bring (PRC) China closer to the USSR and 3) He believed that the distraction and effort the Korean war would cause would protect the Soviet Union and allow her to build her strength for the coming war.
Stalin believed that war with the West was inevitable and felt that dragging America into a war they could not win easily (initially it looked like North Korea would overwhelm the South before an American intervention could arrive, forcing the United States to commit more resources and energy to liberating the South). Stalin also believed that the PRC would never allow the United States to fully win, gambling that a Chinese intervention (which did occur later) would drive the US and PRC further apart, preventing any rapprochement between the two. The PRC may have been Communist, but they were no friends of Stalin's USSR. Sino-Soviet relations are beyond the scope of this question but to oversimplify, they were complicated with the Soviet Union even providing aid to the Kuomintang pre-ww2.
Thirdly, Stalin felt that the UN forces, here meaning mostly Western/Western bloc nations, would be unable to launch an invasion of the Soviet Union after exhausting themselves in Korea. He felt that the distraction of a Korean war would give the Soviet Union time and room to solidify its grasp over Eastern Europe, which at the time was really the centerpiece of Soviet strategy.
It is also important to note that North Korea not only ignored UN calls to deescalate the initial skirmishes that occurred before the full invasion, but directly threatened to drive UN forces (at this point acting as observers and peacekeepers) off the peninsula. The UN did not immediately jump into war, but rather, through a series of resolutions such as UN resolution 82, gradually escalated their calls for peace. As North Korea ignored the gradually escalating calls for peace, Resolution 83 was finally passed that authorized foreign intervention in Korea, which the US would shortly use to enter the war, along with various other allied nations. It is also important to note that perhaps Stalin was justifying reckless action ex post facto, but as we cannot read minds as historians we can only go by his words and I have no access to documents clarifying a different position.
In brief summary, the Soviet Union was boycotting the UN and allegedly secretly supported the intervention, or at least viewing it as a good distraction from European affairs. The Chinese seat was given to the ROC in Taiwan meaning no veto was coming, and the West had not fractured as it would after Suez (which would make France more of a wildcard).
More can always be said, but meanwhile look at this answer from /u/Killfile