To achieve a smooth transition from a Perspective camera to Ortho (and back), @someonewithpc's answer gets you part of the way there. However, that solution just jumps between Perspective and Ortho; the transition is not smooth. Use the following steps:
- Set a keyframe for your camera's location (I -> Location)
- In Camera Properties, set a keyframe for your camera object's Focal Length (it's in the Lens panel) by either RMB the value and choosing Insert Keyframe or hovering your mouse over the value and pressing I. (Note: this assumes that your camera is in Perspective view to start.)
- Move forward in time to where you intend to have your transition to Ortho complete.
- Increase the Focal Length to a very high value (The soft limit is 5000mm, but you can manually enter higher numbers. Typically, however, around 1000mm should be sufficient.) You should notice right now that everything feels zoomed in very close. Don't worry about that just yet.
- Insert a keyframe for your new Focal Length (hover -> I or RMB -> Insert Keyframe).
- Grab (translate/move) your camera along its local Z-axis... you will need to move it very far. Try moving it by 100 units to start (G -> Z -> 100 -> Enter). You will also probably need to adjust your camera's clip range... both the Start value (to remove artifacts) and the End Value (to ensure visibility). Keep grabbing your camera and moving it along it's local Z-axis until it looks very similar to the Orthographic camera (you can quickly switch between Perspective and Ortho in the Lens panel of Camera Properties to check).
- When you're happy that your perspective view closely matches the ortho view, insert a keyframe for your camera's location (I -> Location).
- Make sure your camera is set to Perspective view in the Lens panel of Camera Properties and insert a keyframe on the Perspective/Ortho/Panoramic buttons as described in @someonewithpc's answer (hover over buttons and press I or RMB -> Insert Keyframe).
- Step forward one frame leftright arrow.
- Change the camera view mode from Perspective to Ortho from the Lens panel of Camera Properties.
- Insert a keyframe for the camera's viewmode as described in #8 and @someonwithpc's post.
That should do it. This should get you a smooth transition from Perspective to Ortho. I know it looks like a lot of steps, but I was just overly thorough with my description. It's pretty easy to do.