The group plans to spend about $100,000 to air a commercial on network and some cable television stations in Iowa and New Hampshire, states that hold early contests in the presidential nomination process, spokesman Alex Howe said Friday.
McCain, campaigning Wednesday in South Carolina, answered a question about military action against Iran with the chorus of the surf-rocker classic "Barbara Ann."
"That old, eh, that old Beach Boys song, 'Bomb Iran,'" he said. "Bomb, bomb, bomb, bomb, anyway, ah ..."
His audience laughed, but MoveOn.org called the comment dangerous.
"America has lived through six years of a reckless foreign policy," an announcer says in the ad. "We're stuck in Iraq. More than 3,000 Americans are dead. And thousands more wounded.
"Now comes John McCain with his answer to what we should do about Iran. John McCain? We can't afford another reckless president."
McCain defended the joke during a campaign stop in Nevada on Thursday.
"Please, I was talking to some of my old veterans friends," he told reporters in Las Vegas. "My response is, Lighten up and get a life."
Asked if his joke was insensitive, McCain said: "Insensitive to what? The Iranians?"
The McCain campaign had no immediate comment to the ad on Friday.
The head of MoveOn said McCain displayed "more out-of-control bravado."
"At a tense moment, when cooler heads in his own party and many retired military leaders are calling on the president to negotiate with Iran, Senator McCain's outburst isn't merely inappropriate; it's dangerous," Eli Pariser, executive director of MoveOn.org Political Action, said Friday.
McCain's comments, posted on YouTube.com, had been viewed at least 118,056 times as of Friday morning.