Requesting a social security number after you win a sweepstakes prize is legitimate. By law, sweepstakes sponsors are required to report prizes awarded to U.S. residents to the IRS if the value is $600 or more. For tax purposes, the sponsors may also choose report prizes of lower values. In order to be sure that the win is attributed to the right person, the sponsor needs to include your social security number on the forms that they send to the IRS.
Note that you should only have to give your social security number when you've received notice that you are an official winner. Requesting a social security number when you enter is rare, and might be a sign of a sweepstakes scam.