Article IV, Section 3 clearly states:
Section 3. New states may be admitted by the Congress into this union; but no new states shall be formed or erected within the jurisdiction of any other state; nor any state be formed by the junction of two or more states, or parts of states, without the consent of the legislatures of the states concerned as well as of the Congress.
The Congress shall have power to dispose of and make all needful rules and regulations respecting the territory or other property belonging to the United States; and nothing in this Constitution shall be so construed as to prejudice any claims of the United States, or of any particular state.
Source:http://www.law.cornell.edu/constitution/constitution.articleiv.html#section3
its legal if the parties involved, and Congress approves it.
also, regarding West Virginia:
On October 24, 1861, residents of thirty-nine counties in western Virginia approved the formation of a new Unionist state. The accuracy of these election results have been questioned, since Union troops were stationed at many of the polls to prevent Confederate sympathizers from voting. At the Constitutional Convention, which met in Wheeling from November 1861 to February 1862, delegates selected the counties for inclusion in the new state of West Virginia. From the initial list, most of the counties in the Shenandoah Valley were excluded due to their control by Confederate troops and a large number of local Confederate sympathizers. In the end, fifty counties were selected (all of present-day West Virginia’s counties except Mineral, Grant, Lincoln, Summers, and Mingo, which were formed after statehood). Most of the eastern and southern counties did not support statehood, but were included for political, economic, and military purposes. The mountain range west of the Blue Ridge became the eastern border of West Virginia to provide a defense against Confederate invasion. One of the most controversial decisions involved the Eastern Panhandle counties, which supported the Confederacy. The Baltimore and Ohio Railroad, which ran through the Eastern Panhandle, was extremely important for the economy and troop movements. Inclusion of these counties removed all of the railroad from the Confederacy.
In terms of the constitution itself, the subject of slavery produced the most controversy. Delegate Gordon Battelle proposed the gradual emancipation of slaves already in the state and freedom to all children born to slaves after July 4, 1865. Although some delegates opposed Battelle’s position, they knew they could not create a pro-slavery document and gain approval from Congress. Following much debate and compromise, the provision written into the constitution banned the introduction of slaves or free African Americans into the state of West Virginia, but did not address the issue of immediate or gradual emancipation.
The United States Constitution says a new state must gain approval from the original state, which never occurred in the case of West Virginia. Since the Restored Government was considered the legal government of Virginia, it granted permission to itself on May 13, 1862, to form the state of West Virginia.
When Congress addressed the West Virginia statehood bill, Massachusetts Senator Charles Sumner demanded an emancipation clause to prevent the creation of another slave state. Restored Government Senator Carlile wanted a statewide election to decide the issue. Finally, a compromise between Senator Willey and Committee on Territories Chairman Benjamin Wade of Ohio, determined that, after July 4, 1863, all slaves in West Virginia over twenty-one years of age would be freed. Likewise, younger slaves would receive their freedom upon reaching the age of twenty-one. The Willey Amendment prohibited some slavery but it permitted the ownership of slaves under the age of twenty-one.
The United States Senate rejected a statehood bill proposed by Carlile which did not contain the Willey Amendment and then, on July 14, 1862, approved a statehood proposal which included the Willey Amendment. Carlile’s vote against the latter bill made him a traitor in the eyes of many West Virginians and he was never again elected to political office. On December 10, 1862, the House of Representatives passed the act. On December 31, President Lincoln signed the bill into law, approving the creation of West Virginia as a state loyal to the Union without abolishing slavery. The next step was to put the statehood issue to a vote by West Virginia’s citizens. Lincoln may have had his own reasons for creating the new state, knowing he could count on West Virginia’s support in the 1864 presidential election. On March 26, 1863, the citizens of the fifty counties approved the statehood bill, including the Willey Amendment, and on June 20, the state of West Virginia was officially created.
In May 1863, the Constitutional Union party nominated Arthur I. Boreman to run for governor. Boreman ran unopposed, winning the election to become the first governor of West Virginia. The Restored Government of Virginia, with Pierpont continuing as governor, moved to Alexandria, Virginia and eventually to Richmond following the war. Pierpont ordered an election to allow the residents of Jefferson and Berkeley counties to determine whether their counties should be located in West Virginia or Virginia. Union troops were stationed outside polling places to intimidate those who might vote for Virginia. Despite local support for Virginia, residents who actually filled out ballots voted overwhelmingly to place both counties in West Virginia. In 1865, Pierpont’s government challenged the legality of West Virginia statehood. In 1871, the United States Supreme Court awarded the counties of Jefferson and Berkeley to West Virginia.
The new state of West Virginia had sectional divisions of its own. While there was widespread support for statehood, public demands for the separation from Virginia came primarily from cities, namely Wheeling and Parkersburg. As a growing industrial region with improved transportation, northwestern Virginia businesses desired a more independent role in government. With the extension of the Baltimore and Ohio Railroad to Wheeling in 1853 and Parkersburg in 1857, the northwest depended much less on Richmond and eastern Virginia markets.
Source:http://www.wvculture.org/history/statehoo.html
there is more to the article, but i skipped the earlier history