There are a couple different types of cucumbers, So try and specify which you are talking about please. There are the kind Hibye posted which are filter feaders much like a feather duster. And he is correct that they will poison and polute the tank if they are stressed or if they die.
There are also tiger tail cucumbers, they are not filter feeders, they eat detritus, they will usually find a place in the sandbed to stay and will filter out the detritus. They would be a great addition to a reef tank, but they also can be poisonous if they die. I have known several people who have kept them and love them, But ive not been willing to take the chance.
Hope this helps.