As long as they are members of the Union, and bound by the pact of the Constitution.
You're looking at it backwards. Even had the South Carolina secession been legal Sumter was still federal property, regardless of where it was located. As such it could be disposed of only through congressional legislation. South Carolina had granted title to the property that Sumter was built on free and clear to the U.S., so they could demand all they wanted but until Congress acted then ownership of Sumter remained with the U.S.