"I do believe that most of the problems we have are going to be solved by you," Obama told a group of students from McKinley Technology High School, according to an Instagram video posted on his account after his unannounced visit.
In the video, a small group of students can be seen gasping in surprise as Obama walks into a room with a cheery "How's it going, everybody?"
The former president has made few public appearances since leaving the White House in January.
Obama will be attending a fundraiser for the Democratic National Committee on September 27, only the second time he's publicly raised money for his party since leaving the White House. Obama attended a fundraiser hosted by former Attorney General Eric Holder for the National Democratic Redistricting Committee back in July.
District of Columbia Public Schools Chancellor Antwan Wilson joined Obama at the school for a discussion with the students about their life goals, pursuing higher education and giving back to their communities.
Former first lady Michelle Obama, who was not with Obama during the Friday visit, made a point of visiting local schools as first lady and has continued since the Obamas moved into a Washington home.
McKinley Technology High School is the only Science, Technology, Engineering and Math application school in the District of Columbia public school system. It also participates in the district's Empowering Males of Color Initiative, which was launched in 2015 in response to Obama's My Brother's Keeper program.
Report a typo to the ABC13 staff