Ryan scored more than 30 goals in four straight seasons beginning in 2008-09, but saw his production fall to 11 goals and 19 assists in 46 games this past season, which was cut short by a lockout.
The right wing has tallied 147 goals and 142 assists in 378 regular-season games, with 251 penalty minutes.
Ryan was the second overall pick in the 2005 NHL draft, behind only Sidney Crosby of Pittsburgh.
The 26-year-old from Cherry Hill, N.J., has two years left on a five-year contract that paid just over $25 million US.
Jakob Silfverberg heads to the Ducks in exchange for Ryan, along with Stefan Noesen and a first-round pick in 2014.
Silfverberg, who turns 23 in October, scored 10 goals and nine assists in his rookie season with Ottawa. The Gavle, Sweden native was a second-round pick of the Senators in 2009.
Noesen just spent nearly four seasons as a forward with the Plymouth Whalers in the Ontario Hockey League. The 20-year-old right wing from Plano, Texas was drafted in the first round in 2011, a pick Ottawa acquired in the trade that sent Mike Fisher to Nashville.
Alfredsson opted to sign with Detroit on Friday after 17 seasons in Ottawa, acting as Senators captain since 1999.
The Senators also signed left wing Clarke MacArthur on Friday to a two-year deal worth $3.25 million US per season. Most recently with Toronto, he achieved career highs in 2010-11 with 21 goals and 41 assists.