First, Obama said we should attack Al Qaeda in Pakistan. Bush and McCain mocked him. Then they realized he was right all along, and attacked Al Qaeda in Pakistan.
Then Obama said we should embrace our proud history of diplomacy. Bush and McCain mocked him. Then they realized he was right all along, and negotiated successfully with North Korea.
Then Obama said we need to focus our efforts in Afghanistan, specifically by sending more troops. Bush and McCain mocked him. Then McCain realized he was right all along, and aped Obama's proposal to send more troops to Afghanistan.
Then Obama said we need to negotiate with Iran without pre-conditions. Bush and McCain mocked him.
Then...
Updated with A little analysis. I think there's a couple of ways to read this.
One is that the reason they're opposing Obama's policies is bluster and political habit, their instinct to whine and smear any opposition, regardless of content. The reason they're adopting his policies is that there's actually some people in the state department with our country's best interests at heart, and they realize that Obama's policies are sensible.
Another reading, as suggested in the comments, is that it's a campaign strategy to coopt Obama's positions and take away his advantage. I think this has a strong chance of backfiring, Obama has already done good work in congratulating himself for his position on Pakistan, I think he's be able to make similar hay here. I also think it makes sense for some but not all of these policies. The North Korea negotiations seem least like a cooption strategy, since Obama wasn't making much noise about North Korea. On the other end of the spectrum, McCain's troops-to-Afghanistan plan is a clear political ploy.
Obama's foreign policy proposals are so common-sense, mainstream and reality-based that I expect we'll see this happen again before the campaign is done. Something to keep an eye on.