I want to correct visual odometry (VO) trajectory with GPS and assign each point of the VO curve a computed GPS coordinate.
Data I have: I have a curve that represents the VO trajectory (blue in the picture) - this trajectory was calculated via some computer vision algorithms and I know coordinates of every point of this curve. Then I only have two GPS coordinates - the start and finish of the "ground truth" (ie. I don't know exactly the whole red curve - I only picture it for clarity).
What I need: How can I correct (stretch/contract etc.) the blue VO curve so that it nears the red ground truth curve as close as possible?

Without a model of the data error or the VO process, you cannot (reasonably) do so. It's tempting to say "let's pick a group that acts on the plane, and find an element that sends the start and VO finish to the start and GPS finish, and apply that to the whole curve". (A typical group to pick might be "translations and rotations" or "projective transformations" or "orientation preserving similarity transformations".) But there's no reason to believe that the transformation you get by doing so has anything to do with the ground truth, and indeed, there's good reason to suspect otherwise: an error in the VO computation near the start (e.g., a slight directional error) leads to a much greater finish-error than does the same error near the end of tracking. Hence in ascribing corrections, you need to weight them accordingly to avoid bias.
I'm going to go ahead and answer the question you almost asked by telling you how to find the similarity transform that does what you need. Let's call the start $S$, the finish $F$, and the GPS finish $G$.
Let $$ u = atan2( (F-S)_y, (F-S)_x) - atan2( (G-S)_y, (G-S)_x). $$ That should be the angle between the rays $SG$ and $SF$. (Subscripts indicate which coordinate you're using.)
Let $s = \sin u; c = \cos u$. Let $$ R = \begin{bmatrix} c & s \\ -s & c \end{bmatrix}. $$ which rotates by an angle $-u$.
Then the function you want is $$ f( \begin{bmatrix} x \\ y \end {bmatrix}) = S + \frac{\|G-S \|}{\|F-S\|}R (\begin{bmatrix} x \\ y \end {bmatrix} - S). $$ That (in a coordinate system where $S$ is the origin), rotates the ray $SF$ to point in the direction $SG$, and then scales it to have the proper length. It's therefore the unique orientation-preserving similarity transform sending $S$ to $S$ and $F$ to $G$.