www.townandcountrymag.com/society/tradition/a22780142/prince-andrew-sarah-ferguson-relationship-timeline/
“In early 1992, the couple legally separated, and in August of that year, Sarah faced an explosive scandal as intimate photos taken of the Duchess with American businessman John Bryan were made public, the Washington Post reports. The Duchess was on summer holiday at Balmoral Castle with the Queen, Prince Philip, and Prince Andrew when the scandal broke. The Queen was reportedly furious, and Sarah returned to London that day, according to the Telegraph. Prince Philip's relationship with Sarah was also badly hurt by the scandal, and it has reportedly not improved much in the intervening years.”
I can’t find an account of the Queen telling Andrew to divorce her yet, but it was 1992 so a lot of the contemporaneous articles aren’t online, and they’ve obviously wanted to draw a bit of a veil since.
I’ll have a look to see if I can find a reference in a biography later. Now I think of it, the notion that HMQ ordered two of the three divorces her DC have gone through, is interesting. They messed up their own marriages but she was the one who had to call time, for publicity reasons, supposedly.