Yep, if there was some obstacle (a wall, for example) barring the position right across character 2, then it wouldn't work, of course. But you didn't say anything about obstacles, so it's assumed, that the square is free and reachable.
For such situations, using a map greatly helps (doesn't even need to have squares, a rough drawn map with marks where everyone is is totally sufficient to get a grip on the surroundings).
Also, as dvvega said, if character 2 is flat-footed (start of combat, hasn't acted yet), then there is no threatened area and hence no flanking opportunity for character 1, until the first action of character 2.
Of course, character 1 could then just delay after character 2, and if both play smart, character 2 could make a 5-ft. step to the left and afterwards character 1 a 5-ft. step to the right of their opponent, thereby getting into flanking position (for that round at least) without provoking an attack of opportunity.
O
12
O2
1
1O2
Bye
Thanee