At the beginning of Act 5, Scene 3, the stage directions read:
Enter, in conquest, with Drum and Colors, Edmund; Lear and Cordelia as prisoners; Soldiers, Captain.
So it was Edmund who took Lear and Cordelia prisoners. Evidently he did so with the aid of the soldiers and the Captain. It is Edmund's triumph, and he has control of both Lear and Cordelia. He intends to ask Goneril and Regan, and also Albany what they want done with the prisoners. He says:
Some officers take them away. Good guard
Until their greater pleasure first be known
That are to censure them.
Then Edmund secretly sends the Captain to murder both Lear and Cordelia in their prison cell. When Albany demands that Edmund turn the prisoners over to him, Edmund stalls for time, saying:
The question of Cordelia and her father
Requires a fitter place.
Edmund's reason for wanting Lear and Cordelia dead is rather complicated. In Act 5, Scene 1 he ends his soliloquy by saying:
As for the mercy
Which he [Albany] intends to Lear and Cordelia--
The battle done, and they within our power,
Shall never see his pardon; for my state
Stands on me to defend, not to debate.
What Edmund appears to be thinking is that there is a possibility that Albany would find out from Lear that Edmund was responsible for betraying his father Gloucester to Regan and Cornwall. Edmund may suspect that Lear and Gloucester have spent some time together, which is true. In that case, Gloucester probably could have told Lear what Edmund had done. Gloucester would know what he had done because in Act 3, Scene 7, when the blind Gloucester cries
Where's my son Edmund?
Edmund, enkindle all the sparks of nature
To quit this horrid act.
Out, treacherous villain;
Thou call'st on him that hates thee. It was he
That made the overture of thy treasons to us...
So Edmund wants Lear dead to prevent Albany, who dislikes him, from finding out that he betrayed his own father in order to be given the title of Earl of Gloucester by Cornwall. After being mortally wounded in his duel with his half-brother Edgar, Edmund has a change of heart and tries to countermand his order to have both Lear and Cordelia killed. But he is too late to save Cordelia. Lear enters carrying her body.
Edmund took Lear and Cordelia prisoners and temporarily has complete control over them. He wants to have them both killed rather than to turn them over to Albany, Goneril and Regan. But Lear manages to save his own life although he cannot save Cordelia from being hanged by Edmund's emissary.