Answer:
The legal action that ended slavery in states that had left the Union during the Civil War was the Emancipation Proclamation.
Step-by-step explanation:
The Emancipation Proclamation was a presidential proclamation and executive order made on September 22, 1862 by the President of the United States Abraham Lincoln, which entered into force on January 1, 1863, abolishing slavery throughout Confederate territory during the Civil War.
At the time of its ratification, the Proclamation freed a minimum number of slaves, but as the Union annexed the Confederate territories, it paved the way for the total abolition of slavery on America. Slavery became illegal through the approval of the 13th Constitutional Amendment, a fact that occurred in 1865.
The executive order was severely criticized in the southern states, whose economic activity was based on slave labor. However, adherence of this measure to all Confederate states ensured Lincoln's main focus: strengthening Union ties.