The intruder is said to have been searching for the Democratic Speaker of the House of Representatives, shouting “Where is Nancy, where is Nancy?” before assaulting her 82-year-old husband.
A suspect is in the custody, while the the violent attack is under investigation by police and the FBI.
Mr Pelosi is understood to have suffered injuries to his head and body.
He is said to be receiving “excellent medical care” in hospital and is expected to “make a full recovery”, spokesman Drew Hammill said in a statement.
Ms Pelosi was not in San Francisco at the time of the attack.
“The Speaker and her family are grateful to the first responders and medical professionals involved, and request privacy at this time,” Mr Hammill said.
Ms Pelosi just returned to Washington this week from a security conference in Europe and is due to keynote an advocacy event Saturday evening with Vice President Kamala Harris.
President Joe Biden and lawmakers from both parties reacted to the assault with shock and expressed their well wishes to the Pelosi family.
White House press secretary Karine Jean-Pierre said: “The President is praying for Paul Pelosi and for Speaker Pelosi’s whole family.
“This morning he called Speaker Pelosi to express his support after this horrible attack. He is also very glad that a full recovery is expected. The president continues to condemn all violence, and asks that the family’s desire for privacy be respected.”
While the circumstances of the attack are unclear, the incident raises questions about the safety of members of Congress and their families as threats to lawmakers are at an all-time high, almost two years after the violent Capitol insurrection.
Members of Congress have received additional funding for security at their homes, but some have pushed for more protection as people have showed up at their residences and as members have received increasing amounts of threatening messages.
Capitol Police, tasked with protecting congressional leaders, said Nancy Pelosi was with her protective detail in Washington when her husband was attacked.
Often at Nancy Pelosi’s side during formal events in Washington, Mr Pelosi is a wealthy investor who owns and operates Financial Leasing Services, a San Francisco-based real estate and venture capital investment and consulting firm.
He married Ms Pelosi in 1963 and the pair have five children. Ms Pelosi became the 52nd Speaker of the House in 2007.