Yes, you can take them together.
If you are on the birth control pill, though, penicillin can make that less effective. You should use a back-up method for the duration of your penicillin use and for a week following.
You can take both penicillin and valacyclovir together as that doesn't get interaacted.