At the ceremony, he applauded bipartisan lawmakers for passing the bill, saying it shows that both parties can come together on issues that matter for the future of the nation's children.
The $4.5 billion bill expands free school meals for low-income students.
The new law also aims to reduce greasy foods and extra calories by giving the government power to decide what kinds of foods may be sold on school grounds, including in vending machines and at fundraisers.
Bake sales and other fundraisers that don't meet the new nutritional requirements would be allowed during the school day as long as they are infrequent.
Cafeteria mainstays like hamburgers and pizza will most likely remain on school lunch menus but become healthier made with leaner meat or whole wheat crust, for example.
Michelle Obama has been a supporter of the bill as part of her initiative to combat childhood obesity. The first lady joined the president at the bill signing.
"We can all agree that in the wealthiest nation on earth all children should have the basic nutrition they need to learn and grow and to pursue their dreams," said the first lady. "Because in the end, nothing is more important than the health and well-being of our children. Nothing,"
The Associated Press contributed to this report.