The main reason why you can not generate .p12 certificate in your keychain because you are using a Certificate Signing Request that is not related to your mac device in generating that certificate that you want to export as .p12.
My scenario was, I reformat my mac mini and use the Certificate Signing Request that was generated before the reformat thinking that they the same. So I created several certificates using the old Certificate Signing Request and when I tried to export the certificate to .p12, the .p12 file type option was disabled.
So I tried generating a new Certificate Signing Request and re-generate all the certificates using the new Certificate Signing Request and it worked. The .p12 option is now enabled.