“…such as intending to lead an obligatory prayer.”
It is understood from the author’s statement, “such as intending to lead an obligatory prayer,” that if one praying alone changes to become an imam during a voluntary prayer, his prayer is valid.
The evidence for this is that Ibn Abbas spent one night with the Prophet ﷺ. The Prophet ﷺ rose during the night, and Ibn Abbas rose and stood to his left. The Prophet ﷺ then took hold of his head from behind and moved him to his right. (1) Thus, in this case, the Prophet ﷺ changed from praying alone to leading the prayer during a voluntary prayer.
Accordingly, there is an explicit report from the Messenger of Allah ﷺ concerning one praying alone changing to become an imam in a voluntary prayer.
The second view on this issue is that it is valid to change from praying alone to leading the prayer, whether in an obligatory or a voluntary prayer. (2)
They argue that whatever is established for a voluntary prayer is also established for an obligatory prayer unless there is evidence to the contrary. Since this is established in voluntary prayer, it is likewise established in obligatory prayer.
The evidence that what is established for voluntary prayer is also established for obligatory prayer unless there is proof otherwise is that the Companions who narrated that the Prophet ﷺ would pray on his mount while travelling, whichever direction it turned, said: “Except that he would not perform the obligatory prayer upon it.” (3) This indicates that they understood it to be established that whatever applies to voluntary prayer also applies to obligatory prayer; otherwise, there would have been no point in excluding the obligatory prayer.