Once the imam has said the salaam, it is permissible for the person who prayed behind him to move, whether the imam has turned to face the congregation or has stayed where he is, or he has got up from his place. But it is better for the person who prayed behind him to stay put until the imam turns to face the congregation, because of the possibility that the imam may be sitting so that he can do the two prostrations of forgetfulness (sujood al-sahw) after saying the tasleem at the end of the prayer. Even better than this is to get up only after the imam has got up.
There is an indication that it is permissible to leave as soon as the salaam has been said in the report narrated by al-Bukhaari (875) from Umm Salamah (may Allaah be pleased with her) who said: When the Messenger of Allaah (peace and blessings of Allaah be upon him) said the salaam, the women got up when he finished his tasleem and he stayed in his place for a while before getting up. One of the narrators of the hadeeth said: We think, and Allaah knows best, that this was so that the women could disperse before any of the men caught up with them.
With regard to the report narrated by Muslim (426) from Anas (may Allaah be pleased with him) who said: The Messenger of Allaah (peace and blessings of Allaah be upon him) led us in prayer one day, and when he had finished praying he turned to face us and said: “O people, I am your imam, so do not go ahead of me in bowing, prostrating, standing or finishing, for I can see you from in front of me and behind me,” what is meant by “finishing” here is the salaam.
Al-Nawawi (may Allaah have mercy on him) said: The words of the Prophet (peace and blessings of Allaah be upon him): “so do not go ahead of me in bowing, prostrating, standing or finishing” indicate that it is haraam to do these things and others that are similar to them. What is meant by finishing is the salaam. End quote.
Imam al-Shaafa’i (may Allaah have mercy on him) said in al-Umm (1/151): The one who has prayed behind an imam may leave when the imam has finished the salaam, before the imam gets up, and he may delay that and leave after the imam leaves, or leave with him, which I like better. End quote.
Ibn Qudaamah (may Allaah have mercy on him) said in al-Mughni (1/328): It is mustahabb for the one who has prayed behind an imam not to get up and leave before the imam, in case he remembers something that he forgot and does the prostration of forgetfulness. End quote.
And Allaah knows best.