If someone gets nailed, it is usually a slang term meaning that they got arrested.
"The police nailed him for the robbery."
If can also mean to have sex - somewhat vulgar slang.
If you nail something, it is an idiom meaning that you did it very well and were successful.
"I nailed that test last yesterday."