Hazrat Sha'bi (may Allah have mercy on him) was asked: A man divorced his wife, she was in her waiting period ('iddah) when she married another man. Now, for which husband should she complete the waiting period? He replied: "She should complete the waiting period for the one with whom the relationship is most recent."
Hadith Referenceسنن سعید بن منصور / كتاب النكاح / 1879
Hadith Takhrij«أخرجه سعيد بن منصور فى «سننه» ترقيم الدرالسلفية برقم:، 701، 702، 703»