The Pledge of Allegiance was written by Francis Bellamy in August of 1892. Congress formally adopted the pledge in 1942, giving it its formal name, The Pledge of Allegiance, in 1945.
The Pledge of Allegiance was originally written to instill a sense of patriotism in the United States youth and a love for their country. According to ushistory.org, the words "under God" were added to the pledge in 1954 by Congress, encouraged by President Eisenhower.
Today, the pledge is commonly recited in schools at the beginning of each school day as well as the start of any congressional session, government meetings and private organization assemblies.