Set in 1850, newly ordained Rabbi Avram Belinski (Gene Wilder) has traveled from Poland to America to become the leader of a synagogue in San Francisco. Once there, the elders have arranged for him to marry the daughter of one of the synagogue leaders. After arriving in Philadelphia, he is mugged by three con men who take all of his money and clothes. Forced to fend for himself as he travels across the country, he gets help from several strangers, including the Amish and railroad workers. He later meets up with Tommy Lillard (Harrison Ford), and they set out across the country. Tommy says that he is going to California to be a part of the gold rush, but he is actually a bank robber.
Throughout the movie, Tommy and the Rabbi experience several adventures, including outrunning a posse on foot (the Rabbi won't travel on the Sabbath), befriending Indians after being attacked by them, and surviving a blizzard while crossing the Rockies. They also learn a lot about each others' customs.
Once they reach San Francisco, the Rabbi sees the con men who robbed him. With Tommy's help, he gets his money back. Later, the three attack Tommy and the Rabbi while they are camping at a beach. Tommy kills one of them, but is then wounded. The Rabbi is forced to kill another one, while the third got away. That night, the Rabbi tells Tommy that he can't be a rabbi anymore because he sinned when he killed that man. As Tommy tells the Rabbi that defending yourself isn't a sin, the synagogue elders show up and think that Tommy is the Rabbi. Avram tells them that he is the rabbi, and they present him with the woman who will be his wife, and they immediately fall for each other. Based on this and what Tommy told him, Avram agrees to remain a rabbi.
While the Rabbi and his new fiance are dancing, the surviving con man shows up and demands a duel with the Rabbi. They go outside, but the Rabbi refuses to kill another person, even with Tommy's help. The Rabbi outsmarts the con man and gets his gun away from him, then presents him with an offer. Do whatever you want in life, just leave his new family alone in San Francisco. If he were to return, he won't guarantee his safety. With that, the elders throw the man out of town and the Rabbi is considered a hero. The movie ends with the Rabbi's wedding, with Tommy serving as the Best Man.