The 32-year-old has been a free agent since leaving the Catalan club last summer and has been training with United for three months in order to help him recover from the anterior cruciate ligament injury he suffered in March.
Valdes came through the ranks of the FC Barcelona youth system, making his senior debut in 2002.
The Spanish World Cup winner, who went on to win 21 major titles with the La Liga giants and has 20 caps for the national side, will provide competition for first choice stopper David de Gea.
Valdés said: “It is a real honour to sign for Manchester United. I would like to thank Louis van Gaal and the club for allowing me to do my rehabilitation and to train with the team at the Aon Training Complex.
“From my short time here, I can already see this is a very special club. I worked with Louis van Gaal during my time at FC Barcelona and to have the opportunity to work with him here at Manchester United is a dream come true.”
United manager Van Gaal said: “I am delighted Víctor has signed for the club.
“Víctor is a very experienced goalkeeper and his record speaks for itself. I have said on many occasions that Manchester United will always be interested in the best players.
“Victor has remained very professional throughout his rehabilitation from injury and has been very impressive during his training sessions with the first team over the past weeks.
“He joins the Club as the number two goalkeeper and is a great addition to the first team.”