A flexible airfoil's battens have the same purpose on a sailboat, windsurfer, hang glider, iceboat, landsailer, 17th century windmill, or anything else. The mast or spar adds stiffness to one dimension (transverse to airflow), the battens to the other (parallel to airflow).
On a rigid airfoil covered by fabric or film, ribs have the same purpose. (Some recent sailboats have such rigid airfoils instead of flexible sails, too.)
The main difference between ribs and battens is that battens usually stiffen only the aft part of the foil. On something that sails on both port and starboard tack, that lets the front part of the foil flex appropriately. (If you found a hang glider that dared to fly inverted, the same would apply.) On a hang glider that doesn't fly inverted, leaving the front part unbattened avoids stress risers and, at any rate, it's only the aft part that would be prone to fluttering like a flag and contributing no lift, were it not stiffened.