In short, my advice would be:
- ask the player’s permission first, and preferably at the time of “death”;
- don’t do it if they’re not okay with it;
- if they are, bring the character more literally back from the dead, rather than retconning events so that they didn’t die at all.
Bringing a PC back from death is fine if the player is okay with it
This kind of thing can be great with villains and other NPCs, thanks to the old “if you don’t see their body…” trope and the various ways D&D worlds allow for interaction between the living and the dead. But for player characters it’s a bit different.
Dungeons & Dragons operates on the principle that player characters are entirely under the control of the player who created them, barring any kind of mind control magic, and even then the player and character have a chance to resist, and in the worst case they constrain how the player plays their character, rather than letting someone else do it for them. There are other games which explicitly hand control of a PC over to the GM (or even another player) under certain circumstances, but D&D (generally) isn’t one of them.
As a result, doing anything with a PC like this - effectively hiding what’s happening from the player, even when their PC would be aware of what’s going on - is likely to cause problems if the player is not given a chance to weigh in. They would probably, at the very least, like a chance to veto the survival of their character (if they are satisfied with the manner of their death in game and story terms), and also to have control over the character’s reaction to being captured, since that’s part of their control over their character.
There’s also the question of what this means in ongoing terms: are you making their PC into an NPC? Are you expecting them to resume playing the original character? And if the latter, what happens to their new PC?
So I would talk to them first, and if they’re not okay with it, don’t do it. These considerations are also why most guides to running a session zero include discussing how players want to handle character death before the campaign begins.
This kind of retcon is best done at the time
If the character has actually died as far as the rules are concerned, then revealing later they were actually alive all along is not in my experience (as both player and DM) a popular or appropriate move. As above, the player of the character can reasonably assume that they control the character’s actions, so if they don’t even know they’re alive, this serves as non-narrative proof that they are dead, on top of the game proof of failing three death saving throws.
If you want to save a character from death, ask the player at the time and do it then. Discuss it openly as a group if you haven’t done so in advance, and make sure everyone’s on the same page, but ideally the character’s player should have final say. If they refuse the offer to avoid death, honour that choice and let the character die. Deciding in secret afterwards that they didn’t die cheapens the player’s acceptance of their character’s death (even if an alternative wasn’t explicitly put to them).
Retroactively changing the outcome for them also puts a question mark over what those death saving throws (and other rules around death and injury) really mean for the rest of your campaign.
You have options other than “they weren’t dead after all”
Many of the above problems are avoided by killing the character and bringing them back from the dead. Luckily, D&D gives you many tools and ways to do that, and I’d advise you use one of those if the player is okay with it.
Those options include things the villains can be planning to do to the player’s character, which can happen at the right time to make a great story moment. This could be simple resurrection - an act that, as Molot pointed out, has built-in veto power because the character’s soul has to be willing to return. The villains could also plan to turn them into an intelligent undead with access to their memories (something that a cult once did to a PC of mine who died at level 1 as part of an evil prophecy, leading to a campaign long plot thread in which my replacement PC helped the party try and stop this). Or perhaps they’ve already made a magical copy of the character using various NPC magics… There are loads of possibilities.