The president also signed proclamations declaring the month of May a special one for several other reasons: mental health awareness; physical fitness and sports; building safety; foster care; Jewish American heritage; Asian Americans and Pacific Islanders heritage; and older Americans.
Obama called Loyalty Day "an occasion that asks something of us as a people: to rediscover those ageless truths our founders held to be self-evident, and to renew them in our own time."
Each generation, he said, included citizens who strengthened our democracy.
"These patriots and pioneers remind us that while our path to a more perfect union is unending, with hope and hard work, we can move forward together," he wrote.
"Progress may come slow; the road may be long. But as loyal citizens of these United States, we have the power to set our country's course."
Law Day, he said, is a chance to remember we face the ongoing task of perfecting our laws to achieve equality for all.
"Opportunity remains painfully unequal for too many among us; justice too often goes undone," he wrote. "Law Day is a chance to reaffirm the critical role our courts have always played in addressing those wrongs and aligning our nation with its first principles."
He urged people to display the U.S. flag in support of the national observance.
When it comes to mental health awareness, Obama noted tens of millions of Americans live with illnesses such as depression, post-traumatic stress and bipolar disorder.
"As a nation, it is up to all of us to know the signs of mental health issues and lend a hand to those who are struggling," he said in his proclamation. "Shame and stigma too often leave people feeling like there is no place to turn. We need to make sure they know that asking for help is not a sign of weakness -- it is a sign of strength."
Along with being mentally fit, Obama urged Americans to be physically fit through efforts such as first lady Michelle Obama's Let's Move! program and the President's Council on Fitness, Sports and Nutrition.
"Together, we are helping cities, towns, and counties raise a healthier generation of kids," he said in a proclamation.
Building Safety Month, he said, is a time to "pay tribute to professionals who design, construct and secure our infrastructure, let us raise awareness about building safety and rededicate ourselves to improving it in the days to come."
Proclaiming Jewish American, Asian American and Pacific Islander heritage month is an opportunity to recognize and appreciate the strength those immigrants and their descendants have brought to the nation, and to work to eradicate prejudices against them.
Foster Care Month is a time to focus on the need to ensure "the nation's hundreds of thousands of youth in foster care get the love, protection and stability of a permanent family."
And May is also a month to recognize the contributions made by the nation's older citizens.
"We are also finding new ways to make sure seniors live with dignity as full members of their communities -- from improving access to healthcare to broadening employment opportunities," Obama wrote.
"Our seniors deserve the best our country has to offer."