The White House Historical Association states "the protections of the White House has evolved form the militia men that protected it in the early 1800s to the current Secret Service and police force that guard it today" (WhiteHouseHistory.org).
Some can say that on October 7, 1823, is when security guards at the White House first appeared. The Commissioner for Public Buildings, Joseph Elgar, recommended to President James Monroe that he should allow the President's house to be guarded by men who would wear plain clothes. They would serve as tour guides for visitors during the day and at night, they would protect the White House (WhiteHouseHistory.org).
Only a few years later, in August of 1842, did the White House establish its first permanent security force. This force included one leader along with three other men by his side. "Their responsibilities were defined only loosely, but they often mingled with crowds at receptions, on the lookout for suspicious looking people, and kept an eye on callers who came to the White House to see the president" (WhiteHouseHistory.org).
On July 5, 1865, the Secret Service division was formed. Its headquarters began in Washington, D.C. In 1870, their headquarters was relocated to New York; however just four years later, it was again relocated back to its original location in Washington, D.C. "In 1908, the Secret Service began providing protection for the President-elect" and 5 years later, Congress authorized the permanent protection of the president (SecretService.gov).
Did you know that all presidents that were elected to office after January 1st, 1997 only receive Secret Service protection while in office and 10 years after their terms. For those presidents that were elected before January 1997, they will continue to receive lifetime protection (WhiteHouseHistory.org)!
Just in Case URL: https://www.whitehousehistory.org/press-room/press-timelines/guarding-the-white-house, https://www.secretservice.gov/about/history/events/