Although the third-in-line to the British throne refused to sing on the track, the 27-year-old plays tambourine alongside Gary Barlow, lead vocalist of pop group Take That, and the Military Wives choir, the British media reported.
Harry will take his place alongside the Commonwealth band on "Sing", the song co-written by Barlow and the composer Andrew Lloyd Webber. It will form part of a commemorative Diamond Jubilee album by Gary Barlow & The Commonwealth Band, to be released later this month.
"We caught him (Harry) on his last day in Jamaica. We turned up and I asked him would he play on the record and he said, 'I don't sing.' But I said: "No, no -- I don't want you to sing, I want you to play the tambourine.
"And so he said it'll cost you. Then we met him later on that night and he did the tambourine hit and we spun it into the track. He probably hasn't got a clue what he's part of just yet," Barlow was quoted as telling a chat show."
He added: "He's a great guy Harry -- a lot of people I met in Australia, he was their favourite. They loved him, especially the older women. I think he's one of the Queen's favourites as well."
Webber said that "the song will become a song that is sung in celebration for many years to come".
"Sing" will be performed live at the Diamond Jubilee Concert in front of Buckingham Palace on June 4.