Depends on where you need it, Apex: Use the userinfo class. UserInfo.getProfileId() https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
VF: Use the $Profile global variable. {!$Profile.Id} https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_profile.htm
Apex: Use the userinfo class. UserInfo.getProfileId()
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
VF: Use the $Profile global variable. {!$Profile.Id}
https://www.salesforce.com/us/developer/docs/pages/Content/pages_variables_global_profile.htm
--Akram
If you're looking for some other profile id that isn't the id of the current user, you have to query it:
Profile p = [select Id from Profile where Name = 'System Administrator'];