The United States began as an experiment in democracy, and the progress we've made in the process has come gradually but not consistently. The idea of a truly secret ballot in American elections is a relatively recent innovation. Voting locations in the nation's first century were put together with few rules, and it was often corruption and chaos.
Polling places might be set up in private homes or “sodhouse saloons”—usually there was some separation between the election officials and the crowd of voters, but there was no privacy for voters. Partisans would corral people to the polls to cast their party tickets and keep other parties’ voters away from the polls—using fists, knives, guns...or any other effective means. Voting could mean risking your life: in the mid-1800s, 89 people died trying to get to the polls.
By the 1880s, ballot reformers were looking for a new way to run elections, one that would wrench some control away from parties and limit vote buying and other fraudulent practices. They found it in Australia.
Australia had been letting people vote in secret. What an innovative idea! The secret ballot system was adopted state-by-state, and everyone had a different idea of how to do it. I've personally voted in more than one election where you filled out slips of paper on a counter with a cardboard divider between each voter. The voting booth has taken many forms, which you can read about at Atlas Obscura.