I believe there are cases where a directory needs to exist in a repository but it’s empty. Either because it will be written into at a later stage, or because the contents have been ignored.
If you remember, Git tracks content, not files. Because there is no content, the directory is not tracked, even if you add it. This might cause problems. The work-around is simple. Just create an empty file in the directory (call it something like .empty, use a dotfile so that it won’t necessarily show up in file lists) and git add this to the repository. Because there is something in the directory, it will now be tracked.
A little inelegant, maybe. But not as inelegant as having code that depends on the existence of a directory.