The 51-year-old was dismissed by the Nerazzurri three games before the end of the Serie A season, in which the club finished seventh and missed out on Europe.
Pioli spent six seasons at Fiorentina as a player and returns with the club hoping to take advantage of the extra Champions League place on offer to Italian top-flight clubs next season.
A statement on the official Viola website read: "ACF Fiorentina announces that it has reached an agreement with Stefano Pioli, who will be entrusted with the technical guidance of the first team.
"Stefano Pioli, as a player, wore the Viola shirt on 156 occasions between 1989 and 1995, also wearing the captain's armband.
"The new Gigliati boss has signed a contract which will tie him to his new club for two years with the option of a third.
"The owners, the directors and everyone at Fiorentina wish the Coach the greatest satisfaction, and offer him a huge 'good luck' for his new job. Welcome back, Stefano."
Pioli has also been manager at Italian clubs Salernitana, Modena, Parma, Grosseto, Piacenza, Sassuolo, Chievo, Palermo and Bologna.