The president was photographed with Abraham Lincoln on April 19, 1865, while he was visiting the White House.
The president has said he never intended to use the photograph to commemorate the Civil War.
In the photo, the president is standing with his hands on his hips as he looks into the camera.
The photograph is part of the Presidential Library of the Presidents of the United States collection, which includes the Gettysburg Address, Gettysburg, Gettys Battle, Getty and Gettysburg Military Records, and the Gettys Papers.
The Library of Congress acquired the photograph in 2013.
The caption reads: Lincoln, April 19th 1865, Getty Library of Photography.
President Lincoln at Gettysburg.
Source: Presidential Library / Getty Images President Lincoln and his wife Ella on the steps of the Getty Library on April 1, 1863.
Source (AP) President Lincoln leaves the Getty Building in Gettysburg on April 11, 1863, as he celebrates the 100th anniversary of the American Civil War in Gettys home state of Pennsylvania.
The Gettysburg Massacre is one of the deadliest battles of the Civil Wars.
Lincoln and the Civil Union forces fought in the Battle of Gettysburg in Pennsylvania in 1863, where Union General Ulysses S. Grant fired his famous rifle at the Confederates troops.
The Union troops lost about 500 dead and nearly 200 wounded, according to historian and historian Donald E. Smith.
President Abraham Lincoln is flanked by General William Tecumseh Sherman, General U.S. Army of the Tennessee, and William J. Stark, commander of the Seventh Corps of the U. S. Army, in Gettysburgh, Pennsylvania, August 31, 1865.
The Confederates had captured the city of Gettys headquarters and forced Lincoln to flee the city.
(AP/John F. Kennedy) President Abraham L. Lincoln is seen in Gettystown, Pennsylvania.
(Photo: Handout via Getty Images) President Donald Trump is pictured in Gettyburg, Pennsylvania in October 2018.
(Image: Handoff via Getty) President Trump poses with the Getty family portrait at the White Houses Museum of Art in January 2021.
(Credit: Associated Press) President Obama is seen on May 17, 2017 in Washington, D.C. (AFP/Kevin Lamarque) President Jimmy Carter is seen with President Donald J. Trump and First Lady Michelle Obama in this image taken on March 3, 2017, at the Kennedy Center for the Performing Arts in Washington.
(Reuters/Yuri Gripas) President Barack Obama speaks to a gathering of the World Peace Foundation at the University of Washington, March 16, 2018, in Seattle.
(credit: AFP/Getty Images) Trump holds a news conference on the White house steps during a signing ceremony to reopen the North American Free Trade Agreement on Capitol Hill in Washington on May 27, 2018.
The United States and Canada are both seeking a waiver to allow them to reopen their markets.
(REUTERS/Carlos Barria) Trump and his son Barron hold a news event at the Capitol in Washington D. C. (Jonathan Ernst) Trump speaks during a press conference in the Rose Garden of the White Senate, May 10, 2018 at the request of Senate Majority Leader Mitch McConnell.
(Mark Wilson/Getty) President Joe Biden holds a White House news conference during a swearing-in ceremony for new Cabinet members at the West Wing of the Department of Homeland Security in Washington June 8, 2018 on Capitol Mall.
Biden was sworn in as the 45th president of the world’s most powerful country on Thursday.
(Mandel Ngan/AFP/Getty, FILE) U.N. Secretary-General Antonio Guterres, right, meets with President Trump at the U and O Chambers of the General Assembly in New York, June 1, 2018.(Jabin Botsford/The Washington Post via Getty Image) Trump arrives to deliver remarks at the United Nations General Assembly at U. N. Headquarters in New New York on June 1.
(Evan Vucci/Pool via Reuters) Trump is sworn in on Jan. 20, 2019, at his inauguration ceremony at the Pentagon in Washington DC.
(Kevin Lamarques/Reuters) Trump, his wife Melania, son Barron, Vice President Mike Pence and First Daughter Ivanka Trump hold a moment of silence during a moment in remembrance of those who lost their lives on the Unebrayments Bridge in Barcelona, Spain, on Jan 9, 2020.
(Rui Vieira/Pool/Reuters/File) First lady Melania Trump walks with her son Barron as they walk along the South Lawn of the Supreme Court in Washington in 2021.
The Supreme Court is set to hear arguments on the constitutionality of Trump’s executive order on immigration from six predominantly Muslim countries.
(Andrew Harrer/Bloomberg via Getty images) President Andrew Jackson, center, is greeted by the Queen of England at the coronation of President George Washington at Buckingham Palace in London, Britain, on April 2, 1805. (