The Dutch attacker has been beset by injury problems since arriving at Camp Nou from PSV in 2011 and has now been allowed to move to Greece in search of regular game time
The injury-plagued Netherlands international has just one year left on his current contract with the Blaugrana and will spend it in Piraeus, the Catalan club announced on their official website on Sunday.
Afellay arrived at Camp Nou from PSV in December 2010 and enjoyed an encouraging start to life in La Liga, making 16 appearances in the second half of the season.
However, the attacker suffered an anterior cruciate ligament injury in September 2011 and his Barca career never recovered.
Indeed, Afellay featured only twice for the Blaugrana last season and, having been deemed surplus to requirements by new coach Luis Enrique, he has now been loaned to Olympiakos for the remaining 12 months of his contract.