Johnstone, who has played for England three times, will provide competition to 35-year-old Vicente Guaita.
"I'm really excited to be here at Crystal Palace, I can't wait to get started," said Johnstone.
"It's a great club with fantastic facilities and brilliant supporters."
Johnstone made his international debut in the 1-0 friendly win over Romania in June 2021 and also played in two World Cup qualifiers against Andorra that year.
Palace chairman Steve Parish said: "Sam is a player we have admired for some time, and we're extremely pleased to welcome him to Crystal Palace.
"His extensive experience at club and international level, alongside his outstanding ability, will add even greater depth to our goalkeeping unit."