Sorry, I didn't see this early enough.
You don't need ID for a court appearance. Any UK passport is actually the property of the British Government; nobody has the right to possess any passport other than their own. (It's actually a criminal offence to be in possession of any passport other than your own. Obviously nobody will get prosecuted for simply 'looking after' someone else's passport but it would be extremely unwise to withhold another person's passport).
I hope that you've given the passport back to your ex. If you believe that he might use it to try to abscond you could notify the police about it but, unless the police or the court imposed a bail condition prohibiting from leaving the country, they'd be powerless to prevent him from travelling.
Chris