WARSAW—President Barack Obama marked the 25th anniversary of Poland's first free elections with an impassioned reaffirmation of U.S. support for Eastern European nations rattled by the prospect of Russian aggression, and held up Poland as a model of transition for Ukraine.

Mr. Obama's speech in Warsaw followed his first meeting with Ukrainian President-elect Petro Poroshenko, who told Mr. Obama he intends to move closer to Europe and...