Chalmers wore a real military uniform for his dance to World War II song Boogie Woogie Bugle Boy, after getting permission from the Royal Navy and the Ministry of Defence, describing it as "the greatest privilege" he could ever ask for.
Prince Harry is friends with Chalmers from his time competing at the Invictus Games, and spoke to him and his professional partner Amy Dowden via a video link.
"When I first met JJ, he was a shell of himself," Prince Harry began. "But then, to see you shine through Invictus and be yourself again, that was the start of an amazing journey."
He added: "I'm so proud, genuinely proud, that here you are in this position now. You are not a dancer, proving that you can actually do anything that you put your mind to which is amazing."
More like this
Chalmers was clearly moved by his touching words and had some high praise for the Duke of Sussex, who founded the Invictus Games in 2014 for wounded, injured or sick armed services personnel.
The medallist and television presenter said: "The simple fact is that if Prince Harry had not created the Invictus Games, I would not have had that catalyst moment that changed my life forever. I wouldn’t be here without him."
The surprise appearance was also exciting for Strictly Come Dancing professional Amy, who has been choreographing and performing alongside Chalmers this series.
"Definitely not your average training session to have Prince Harry call in on you… wow," she said.
Chalmers scored a total of 17 points for his performance, with Tess Daly and Anton Du Beke offering their salute for his service in the Armed Forces.
Strictly Come Dancing continues Saturdays at 7:10pm on BBC One. Check out what else is on with our TV Guide, or take a look at our new TV shows 2020 page to find out what's airing this autumn and beyond.