For for this cause was the gospel preached also to them that are dead, that they might be judged according to men in the flesh, but live according to God in the spirit.
The gospel was shared with those who have passed away so they can be judged based on human actions in their physical lives, but can live following God's ways in their spiritual existence.