The First Amendment was authored by James Madison, who was inspired to write the document by Thomas Jefferson. Additionally, Madison proposed all 10 amendments of the U.S. Bill of Rights.
It wasn’t until 10 years after he had written it that Madison realized the importance of the First Amendment. He never thought the federal government would grow so large as to need it. He viewed freedom of the press as a useful tool against a monarchist government, and was spurred by his mentor Thomas Jefferson to propose it and the Bill of Rights. He wrote the First Amendment to separate church from state, allow for religious freedom, and to allow for free assembly and a free press.