Marriage to a foster child's former spouse is permissible 33:37-41
33:37 And when you said to he whom Allah had favored and yourself have favored, 'Keep your wife and fear Allah,' and you sought to hide in yourself what Allah was to reveal, fearing people; although Allah has a better right for you to fear Him. And when Zayd had accomplished what he would of her (divorce), We gave her to you (Prophet Muhammad) in marriage, so that there is no fault in believers concerning (marriage to) the former spouse of their foster children if they divorced them. The decree of Allah must be done.
33:38 No fault shall be attached to the Prophet for doing what Allah has obligated for him. Such was the way of Allah with those who passed away before, the decree of Allah is a decree determined