You're looking for SecItemExport.
CFDataRef exportedData;
OSStatus ret = SecItemExport(arrayWithIdentityAndCert,
kSecFormatPKCS12,
0, /* Use kSecItemPemArmour to add PEM armor */
NULL,
&exportedData);
if(ret == errSecSuccess)
{
/* exportedData now contains your PKCS12 data */
}