It is a momento of some prior posting or joint exercise from Captain Ramsey's past.
US military personnel tend to collect momentos during their service, often gifts they receive when they depart certain commands or units. These kinds of things can be plaques, framed photographs, models of military equipment, etc. Sometimes for joint exercises including multiple countries, participating commanders will will get engraved pedestals with the flags of participating nations in them. The flags on the desk in this scene (Iceland, USA, and possibly Italy--another NATO country) look like they may be a part of something like that. Many times, servicemen who do not mind doing a lot of dusting will keep these momentos to decorate their new offices or living quarters. That's what you're looking at on Captain Ramsey's desk--a momento from some prior posting or exercise that was either in Iceland or included Icelandic (and possibly Italian) joint partners. There is no official purpose for any foreign flag--or even the US flag--on the desk in a US Navy captain’s quarters.
It is worth noting that there is a fourth and fifth flag visible on the desk only in the close-ups of Hackman that disappear in the wider shots--a continuity error. One is a green flag with an unidentified seal on it--probably not a national flag. The other might be Norway, but it is difficult to be certain.