you can backup in iTunes before jailbreak and restore you backed up data after jailbreak
you can also sign up for a trial Mobile Me account and all your contacts (as well as calender etc.) will be sync'ed over the air. after you jailbreak and get your MobileMe account setting back on the phone, all the contacts just reappear automatically