Well those people who stole your poo just performed a medical procedure upon you without your consent. That poo is 'you' I'm pretty sure... Whoever has the best lawyer wins.
Is it legal to test someone without their knowledge or consent? Like if I MITM the public toilet and start drug testing random passersby... well the results would probably be skewed due to contamination... Now that I think about it, this kind of massive, drive-by poo-veillance is actually a really hard problem.
Wait I'm getting distracted. Yeah, original question: is consent needed before such testing can be done? Mileage varies by state maybe?