The sequence can be arbitrarily long if we allow repeated moves, e.g.
[Title "Every other White move allows mate in 1"]
[FEN "2B5/8/R7/4rp2/2P5/1PkP4/2p6/2K6 w - - 0 0"]
1. Re6 Ra5 2. Ra6 Re5 3. Re6 etc.
Naturally if the "certain loss" incurred by a deviation is allowed to take
longer than mate in 1, there are simpler positions, even with only
one Black pawn in addition to the two Kings; for example in the following
position White must "find" 10 only moves before the first repeat,
though it might take Black as long as 26 moves to punish a misstep:
[Title "Every other White move loses"]
[FEN "8/8/k5p1/8/8/8/K7/8 w - - 0 0"]
1. Kb2 Kb6 2. Kc2 Kc6 3. Kd2 Kd6 4. Ke2 Ke6 5. Kf2 Kf6 6. Kg2 Kf5 7. Kf3 Kg5 8. Kg3 Kh5 9. Kh3 Kg5 (9... g5 10. Kg3) 10. Kg3 etc.
I'm assuming that only one side's moves must be unique in this sense;
if you want both White and Black to be walking such a tightrope at once,
see Rewan Demontay's example of a "Nunn sequence".