When you log into BF2 at the main login screen click on the MANAGE ACCOUNTS button.
Then click on the FORGOT PASSWORD button. This will then bring up a window telling you that this window will close BF2 and open the GameSpy Account website. You can retrieve your password there.
The password will be sent to the email address entered at the account creation.
Edit: If you forgot which email address you used...just go to C:\document and settings\owner\my documents\battlefield2\profiles and there should be one or two files in there depending on how many accounts you have, 0001 0002 0003 Default etc.
Just open the one called PROFILE.CON in notepad or Word (basic text file) and get the email address from here.