Stark used the tesseract to power the proto-Iron Man suit, which is why he was able to build it 60 years ahead of schedule. Red Skull got his hands on the tesseract when he recovered Steve and the armor from the wreckage of the train, and used it to open the portal.