The multihour event held on the Great Lawn in New York's Central Park also featured Vice President Joe Biden, Hugh Jackman, Bono, Leonardo DiCaprio and Pearl Jam, who closed the event with a rocking performance.
Obama first appeared in a video promoting the 62 Million Girls campaign, but she later walked onstage after Beyonce introduced her following her performance.
"Let's give it up for the amazing Beyonce," Obama said. "I am thrilled to be here tonight ... And honored to follow a woman who I admire and adore."
Obama said she learned how to "speak up" in school. "Right now 62 million girls are not in school ... They deserve the same chances to get an education as my daughters and your daughters," she told the feverish audience, who cheered her on.
Also Read
President Barack Obama also appeared in a video at the event, in its fourth year and aimed at ending poverty around the world.
Yousafzai, the 18-year-old Pakistani activist, was passionate as she spoke about fighting for the right for all children to receive an education.
"I want education to be the top priority because how can we end poverty ... When we deny the right to education," she said. "It's not that there is lack of money in this world ... we have billions and trillions of dollars, but where the money goes is military, it's things that are useless and that are not useful to society."
The event, which aired on MSNBC, was hosted by Stephen Colbert, Kerry Washington, Salma Hayek Pinault, Olivia Wilde and other top celebrities. Usher, Jason Sudeikis, Laverne Cox, Katie Holmes, Facebook CEO Mark Zuckerberg and Bill and Melinda Gates also attended the event, along with multiple world leaders, including UN Secretary-General Ban Ki-moon.