Somewhere between ten minutes and a couple of hours
According to The Hollywood Reporter, who spoke with an anonymous on-set source in May 2016, the two films are only separated by about ten minutes1:
"This is the closest thing to a prequel ever," a source tells THR. "This takes place just before A New Hope and leads up to the 10 minutes before that classic film begins. You have to match the tone!"
While Leland Chee said on Twitter that it was no more than a couple of hours, and potentially not even as long as that:
@TheIdDM: How much time passes between RO and ANH? Is it a matter of hours or days? Thank you!
@HolocronKeeper: Hours, if that. They're relatively close on the galactic map.
Although this may seem difficult to believe, it's worth keeping in mind that Rogue One ends with the Tantive IV fleeing Scarif in hyperspace:
"Star Destroyer closing!" called the officer at the tactical console. Raymus didn't recognize the face — one of Raddus's men.
He erased the fear from his own expression. "Get us into hyperspace," he said.
Rogue One: A Star Wars Story - Official Novelization Epilogue
With Vader in hot pursuit:
Vader clenched his gloved hand until the man’s neck snapped. Then he tossed the body aside. He activated his comlink and barked to his stormtroopers, "Find their escape vessel."
[...]
Darth Vader chased his quarry, seeking solace in the final triumph of the Emperor.
Rogue One: A Star Wars Story - Official Novelization Epilogue
Since Leia already knew where she was going, there are only two events that occur between the end of Rogue One and the beginning of A New Hope:
- Vader figures out Tantive IV's destination
- The two ships travel from Sacrif to Tatooine in hyperspace
We don't know how long it would have taken Vader to track the Rebel ship; the canon novel Tarkin suggests that it's basically impossible to track a ship in hyperspace, and Vader only manages to do so in that novel because the ship he's tracking is carrying his own meditation sphere; later in the book they're forced to resort to statistical inference and psychological profiling to determine targets, both of which take time.
However, we have every indication that the actual trip wouldn't take long at all; Entertainment Weekly's Ultimate Guide to Rogue One, which was produced in collaboration with the filmmakers, included an updated galaxy map showing just how close Scarif (red circle) is to Tatooine (blue circle):
They are quite close indeed, and it doesn't surprise me that it would only take a few minutes to travel between them at lightspeed.
1 Perhaps worth noting that Pablo Hidalgo doubts this to be true