Dorsey, a seventh-round selection and two-time Heisman Trophy finalist, was the first of the team's draft picks to sign this year. He got a three-year deal.
No financial terms were disclosed.
Dorsey is a native of Orindo, Calif., and is a lifelong 49ers fan.
"It's rare that someone has the opportunity to fulfill a childhood dream," his agent, Leigh Steinberg, told the San Jose Mercury News. "Ken grew up dreaming of playing for the 49ers. With his skill set (and) his intelligence and his pinpoint accuracy, he should be an excellent fit.''
Scouts have said his NFL tenure could be hampered by a lack of arm strength.
Celebrity Breakups and divorces of 2014 [PHOTOS]