Barry Allen was trapped inside the speedforce. Team Flash had attempted to get him out. It worked but the portal didn't open in the correct place...or even the correct earth. Barry winds up on Earth-X, where they had just recently mysteriously lost their Barry Allen.