According to the White House Historical Association, our nation's 9th President, William Henry Harrison, was the first sitting president to be photographed. A formal portrait was taken of Harrison by two amateur photographers in the Capitol on March 4, 1841, the day of his inauguration.
Bonus Question:
Who was the earliest U.S. President to have had his picture taken?
Answer:
John Quincy Adams, our 6th President, was photographed in 1848, twenty years after having left office.