Will I be shocked! Shocked to find that plagiarism is going on in here?
I don't know. There are just a lot of similarities.
Hemingway published a book called To Have and Have Not in 1937, based on some of his earlier stories. Then, in 1940, someone wrote the play that would become the film, Casablanca. I haven't read them, so I don't know how similar they might be. There are, apparently, a number of differences between the 1940 play, and Casablanca. Then, after Casablanca, Hemingway's book was turned into a screenplay, by Hemingway, Howard Hawks, William Faulkner, and another writer. That's a lot of talent in one screenplay, so there wouldn't seem to be any need to plagiarize. But there are a number of similarities.
As the movie was filmed during World War II, Hawks moved the setting from Cuba to Vichy-controlled Martinique to placate the Roosevelt administration. They objected to the unfavorable portrayal of Cuba's government as against the U.S. government's "Good Neighbor" policy toward Latin American nations. This change created many similarities to the plot of Bogart's earlier, highly successful Casablanca (1942). Other changes tended in the same direction, such as the introduction of a sympathetic piano player as an important supporting character. Carmichael's Cricket was not in the Hemingway book, and parallels Dooley Wilson's Sam in Casablanca. Several cast members from Casablanca also appear in the film; apart from Bogart and Dalio (Emil in Casablanca), Dan Seymour (Abdul in Casablanca) plays Captain Renard, whose name and position parallel Captain Renault in Casablanca. As in Casablanca, Bogart's initially reluctant character assists husband-and-wife Resistance members.
Also, both movies have Bogart reluctantly rescue a freedom fighter, and his beautiful wife, from the Nazis. In both, he holds Vichy officials at gunpoint, to execute his plan.
But all that stuff about the backstory of the film is coming straight from Wikipedia. It's worth what you paid for it.
CasablancaTo Have and Have Not