Video: http://media.sports.ign.com/articles/674/674208/vids_1.html
Simply pull back on the right analog stick to load your swing, then time the pitch and press up to swing the stick. To maximize your chances of making contact, you'll need to be smooth with the transition from pulling back to pressing forward. If you hold the stick back for too long before swinging, you'll get little power on your ping, weakly dribbling the ball in the infield. The longer you hold down, the longer the penalty.
Hold R1 or the R trigger while swinging to hit for contact. Hold L1 or the L trigger while swinging to hit for power.