I'd say the ideal height for a soccer player is around 6'0" (like Ronaldo), though Messi is only like 5'7".
That's like saying that the ideal height for a basketball player is 6'7... kind of maybe but not always, really.
The real answer is "it depends". Goalies, center backs, and strikers need to be taller. Other backs, wings, and forwards, not so much.
Edwin van der Sar was a world-class player, and he was 6'6. Peter Crouch, 6'7. Jan Koller, 6'8 (have in mind these are barefoot measures, too). There are also plenty of other - taller - examples that I'm too lazy to track down now.