Hillary Clinton vowed not to send American ground troops to Iraq “ever again” and Donald J. Trump insinuated that he had learned shocking new information involving President Obama — without ever revealing it — as the two candidates made back-to-back appearances Wednesday night at a forum that foreshadowed their highly anticipated debate later this month.

Mrs. Clinton, who was frequently put on the defensive by audience members asking questions about her judgment, sought to reassure voters that she would be a forceful and steady commander in chief, noting her role in the killing of Osama bin Laden and pledging that defeating the Islamic State was her “highest counterterrorism goal.”

She promised air power and other support to Arab and Muslim allies but added, “We are not putting ground troops into Iraq ever again, and we’re not putting them into Syria.”

Mr. Trump was withering in his attacks on her record while vague about his own, and defensive about his shifting stands on the Iraq war over the years. He repeatedly declared that he was ready to handle national security issues, without being challenged.