The Book of Mormon text allows various relative pronouns—that, which, and when—to refer to the noun time. And occasionally there has been some shifting between these relative pronouns. Here in Alma 40:5, the original manuscript reads when; there is no correcting that supralinearly inserted after the when, nor does when appear to be crossed out or erased. Oliver Cowdery simply replaced the when with that when he copied the text from 𝓞 into 𝓟; the that is consistent with nearby usage:
Oliver’s replacement of when with that could have been influenced by the use of that in the two preceding occurrences of “time that” (in Alma 40:4–5). A more immediate influence could have been the two preceding occurrences of that in the same sentence: “and it sufficeth me to know that this is the case that there is a time appointed that all shall rise from the dead” (the reading in 𝓟).
Even so, there are examples elsewhere in the text where the relative pronoun modifying time is when, including a nearby one in verse 10 of this chapter:
Consequently, there is no reason to reject the reading of the original manuscript here in Alma 40:5. For another example where “time when” was replaced by “time that”, see under Alma 9:18.
Summary: In accord with the reading of the original manuscript, restore the relative pronoun when in Alma 40:5: “there is a time appointed when all shall rise from the dead”.