The Japanese invasions of Korea comprised two separate yet linked operations: an initial invasion in 1592, a brief truce in 1596, and a second invasion in 1597. The conflict ended in 1598 with the withdrawal of the Japanese forces from the Korean Peninsula after a military stalemate in Korea's southern coastal provinces.

The invasions were launched by Toyotomi Hideyoshi with the intent of conquering the Korean Peninsula and China, which were respectively ruled by the Joseon and Ming dynasty. Japan quickly succeeded in occupying large portions of the Korean Peninsula, but the contribution of reinforcements by the Ming, as well as the disruption of Japanese supply fleets along the western and southern coasts by the Joseon Navy forced a withdrawal of Japanese forces from Pyongyang and the northern provinces to the south, in Busan and nearby southern regions. Afterwards, with guerrilla warfare waged against the Japanese by righteous armies (Joseon civilian militias) and supply difficulties hampering both sides, neither the Japanese nor the combined Ming and Joseon forces were able to mount a successful offensive or gain any additional territory, resulting in a military stalemate.

The first phase of the invasion lasted from 1592 until 1596, and was followed by ultimately unsuccessful peace negotiations between Japan and the Ming between 1596 and 1597.

More Info: en.wikipedia.org