openssl pkcs12 -export -out cert..pkcs12 -inkey privateKey.key -in cert.crt -certfile CACert.crt
----
===== With an intermediate certificate =====
You need to concatenate all the PEM files into one, then convert it to PKCS#12:
cat certificate.crt intermediate.crt > bundle.crt
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in bundle.crt