Yes, you can send messages to a locked profile irrespective of their privacy settings. The only exception is if the other person has blocked you; then, in that case, you cannot send messages.