Mr Walsh said the law change would give schools "very little'' power to detect drugs.
Teachers would still be able to take reasonable steps to make students surrender items.
But they but could not require students to present a medical certificate because that would require them giving a sample - which the bill explicitly prohibits.
Mr Walsh said the current practice in schools was to suspend students caught using drugs at school.
"And as a condition of returning to school they are required to undergo a drug test to ensure that they're drug free.
"This will prohibit schools from doing this and I think will compromise the safety of that student, because we won't know whether they're on drugs or not, and also compromise the safety of other students.''
Mr Walsh said he was not suggesting all students should be randomly drug tested.
"It's only the ones that are caught using drugs and for their safety, they should be required to undergo drug testing.''