A black toenail often results from the toe striking the end of the shoe. It doesn't have to be a painful injury for enough pressure to occur to cause the bruising. It could also happen due to a fungal infection.
If your toenail has turned black it could be a number of things causing it there are different treatments for all of them but the best advice see your Doctor.