The following is from a website I found. I edited it to keep it brief.
The Pledge was written in 1892 by Francis Bellamy. He was an American, a Baptist minister and Socialist. In its original form, it read:
"I pledge allegiance to my Flag and the Republic for which it stands, one nation, indivisible, with liberty and justice for all."
It was first published in a children's magazine, Youth's Companion, in 1892 to celebrate the 400th anniv. of Columbus' arrival in the Americas.
The word "to" was added before "the Republic" in 1892-OCT.
By 1924, the National Flag Conference, under the leadership of the American Legion and Daughters of the American Revolution, changed the words, 'my Flag,' to 'the Flag of the United States of America.
In 1953, the Roman Catholic men's group, the Knights of Columbus, mounted a campaign to add the words "under God" to the Pledge. The nation was suffering through the height of the cold war, and the McCarthy communist witch hunt. It was changed under the direction of President Eisenhower.
I hope this helps and a very happy 4th to you all.