A formal contract isn’t necessary, but you or the JP may want one.
If the ceremony is very soon, a formal agreement may not be feasible, but a simple written confirmation certainly is. This could be something as simple as an email or text outlining services including date, time, fees, and contact information.
If the wedding is scheduled for down-the-road, some sort of written confirmation is advisable. Especially if the wedding is large and formal. This protects both you and the officiant. Most JPs will require a deposit to hold the date.
In general, a contract makes sure that both parties understand that a commitment was made. It protects the couple by making sure the Justice of the Peace or notary remembers that s/he made a promise to be there, and it spells everything out in detail. Things to look for in a contract include fees, optional additional fees, payment schedule and details about the marriage license. You’ll also want to know what will happen if your plans should change. You can be assured that a JP who uses a contract is a professional who wants to work with you to ensure your needs are met and that there aren’t any surprises.