Going back to the OP, there are two different subgenres mentioned...
Warhammer 40k has fantasy tropes such as elves and orcs thoroughly mixed with SF ones like space travel. An obvious parallel that springs to mind is Julian May's Saga of the Exiles, in which humans from the near future are sent back to the Pliocene era using a time machine, only to find prehistoric Europe already inhabited by aliens who bear a remarkable resemblance to characters out of Celtic myth and folklore...
Terry Brooks' Shannara series, on the other hand, is to all intents and purposes conventional fantasy that eventually turns out to be set in a post-apocalyptic future. I shudder to place the sublime Richard Morgan in the same company as Brooks, but there are definite hints that the setting for The Steel Remains is, if not an actual future Earth, then something very close, and that all the "magic" may actually be extraordinarily advanced technology. However you could omit those hints and the few blatant SF tropes, and it would be indistinguishable from a secondary world fantasy - which is not the case with Warhammer 40k.