Does a photon honor the causality principle? We know that the faster you move, the slower your time is perceived from an external observer and the space along the direction of the movement shrinks.

Photons, having no mass, move at the speed of light c (in the vacuum) and for them the space has no meaning because it's collapsed into one single point (edit: better say into a single plane, because only the direction along the path collapses). Actually, they don't "move", just "are" at the same time in all places along their path.

In the same way, for them time has no sense. Because they don't "move" they take 0 time to reach their destination. 

This seems to be odds we the causality principle, but of course I'm wrong.
I try to explain it with a simple example. Let say a photon is emitted from a very far star millions of years ago and I receive it in my eye now. It means its path was started on that star and ended in my retina.

It took millions of years, for us, and 0 seconds from its point of view. 
So, I apologize for the stupid question, but how it was able to "know" that my retina will be there? If I was few cm apart, perhaps it would have continued for other million of years until it will eventually reach something other. But for it, the time is still 0.

How this could be explained?

And, we know the speed of light is less than c in other media. But it's not clear to me if from the point of view of a photon changes something. For it, the space and time are still 0? As an external observer I can say it still moves as fast as it can. From its point of view it's always in all points of its path.

Is it correct?
Instead of saying "space has no meaning because it's collapsed into one single point" it's a lot easier if you say that a photon is not at rest in any frame. Then all of the paradoxes you mention go away. 

It's easy to use the Lorentz transformations (the mathematical core of special relativity) to show that it's impossible to transform a frame moving at $v&lt;c$ to $c$, or vice versa. (Actually, the Lorentz transformations were developed / discovered a decade or so before Einstein proposed the theory of special relativity. His great insight was to realise that those transformations made more sense if you abolish the hypothesis of the luminiferous aether, and treat space and time as a united geometric structure).

In relativity theory, it simply doesn't make sense to talk about "the point of view of a photon". A photon doesn't have a point of view because it's not geometrically possible for an inertial reference frame to have a velocity of $c$ relative to any other inertial reference frame.

The geometrical structure of spacetime proposed by relativity theory has important implications for causality because no causal influence can travel faster than $c$. Two key concepts here are light cones, and the relativity of simultaneity. There are plenty of questions on this topic on the Physics stack, so I won't go into the details here, but very briefly, if a photon leaves spacetime event A and is absorbed at spacetime event B, then all observers will agree that A occurred before B, although different observers may measure different spatial distances between A &amp; B and different time durations between A &amp; B, but they will all agree that the (local) speed of the photon was $c$. We say that the spacetime interval between A &amp; B is light-like (or null).

If spacetime events A &amp; B have greater space separation than time separation, eg in my frame, B happens 1 second after A, but the distance between them is 2 light-seconds, then we say that the spacetime interval between them is space-like. No causal influence can travel between them, and different observers will disagree on whether A happened before B, or vice versa, and for some observers A &amp; B occur simultaneously. Here's a nice diagram from the Wikipedia article on the relativity of simultaneity:




  Events A, B, and C occur in different order depending on the motion of the observer. The white line represents a plane of simultaneity being moved from the past to the future.