Charles was in Ayr for a parade by the Queen's Own Yeomanry, of which he is the Royal Honorary Colonel.
As he left a civic reception at Ayr Town Hall, he met Private Barry Rooney and his new wife Kirstie as they left their wedding ceremony at the Registrars' Office in the same building.
The Prince offered his congratulations to the couple and posed for some special photographs for their wedding album.
Pte Rooney, 28, and his 22-year-old wife, from Patna in East Ayrshire, said: "That was absolutely amazing, we were really shocked. Who can say they had their wedding photograph taken with the Prince of Wales?
"It's a day we'll remember forever."
Earlier in the day, Charles, known as the Duke of Rothesay in Scotland, took a royal salute from the Queen's Own Yeomanry as they marched through Ayr town centre.
Dressed in multi-terrain Army uniform, the Prince then attended an honorary freedom ceremony for the regiment at the Auld Kirk in the town before the civic reception with soldier and their families.
Hundreds of people lined Ayr town centre for the parade and Charles took the royal salute from around 150 soldiers at Wallace Tower.
The Queen's Own Yeomanry was originally formed in 1971, but the current regiment, which has five squadrons based in Ayr, Belfast, Cupar, Newcastle and York, was formed in 1999.
It has served in the Balkans, Northern Ireland, Cyprus, Iraq and Afghanistan. Under Army restructuring it will lose squadrons in Ayr, Belfast and Cupar which are being rolled into one new regiment from July, called the Scottish and North Irish Yeomanry.