It depends on whether you consider the bag itself to be a "location"
The Horizon Walker Ranger's Detect Portal feature states:
At 3rd level, you gain the ability to magically sense the presence of a planar portal. As an action, you detect the distance and direction to the closest planar portal within 1 mile of you...
See the "Planar Travel" section in chapter 2 of the Dungeon Master's Guide for examples of planar portals.
The section on "Planar Travel", specifically the section on "Planar Portals" states:
"Portal" is a general term for a stationary interplanar connection that links a specific location on one plane to a specific location on another. Some portals function like doorways, appearing as a clear window or a fog-shrouded passage, and interplanar travel is as simple as stepping through the doorway. Other portals are locations-circles of standing stones, soaring towers, sailing ships, or even whole towns-that exist in multiple planes at once or flicker from one plane to another. Some are vortices, joining an Elemental Plane with a very similar location on the Material Plane, such as the heart of a volcano (leading to the Plane of Fire) or the depths of the ocean (to the Plane of Water).
The requirements for a Planar Portal:
1. It must be a "stationary interplanar connection"
2. It must link a location on one plane to a location on another plane.
A "stationary interplanar connection" would be like a stationary connection between two cellphones. It does not mean that the phones are not moving, it means that the connection is stable, this is supported by the fact that locations which change planes or exist in multiple planes count as portals, especially when it can be a moving, sailing ship.
We know that a Bag of Holding is an extra-dimensional space as shown in the question "Is the interior of a Bag of Holding actually an extradimensional space?". The Portable Hole item states:
[...] Placing a portable hole inside an extradimensional space created by a bag of holding, Heward's handy haversack, or similar item...
Additionally, extra-dimensional spaces and demiplanes are the same things in fifth edition as shown in the question: "Is the “pocket dimension” a familiar goes into a demiplane or an extradimensional space?".
Thus the inside of a Bag of Holding is a demiplane; it is its own plane of existence. We also know that it is a constant/specific plane of existence as the contents of the bag are always all there. The problem though is this: Does the bag itself count as "a specific location on one plane"?
What ultimately counts as "a specific location on a plane" will be up to your GM; however, we do have some examples that are mobile: sailing ships or towns, if they exist in multiple planes, or change planes.
A Bag of Holding does not do anything more drastic than these locations, and the connection is no less "stationary".
That said, a ship and a city are certainly locations, but calling a bag (though a magical one) a location isn't a particularly natural feeling statement.
If a Bag of Holding were considered to be a location, then it would qualify as a Planar Portal and thus be detected by Detect Portal.
Note that Detect Portal only detects a portal within 1 mile. What 1 mile means when crossing planar boundaries is not defined by the rules, so how Detect Portal works if a portal is on a different plane of existence would be up to a GM.
Also as user @Black Spike points out, Detect Portal only finds "the closest planar portal within 1 mile of you", and so it will always find only the single closest. If the party were currently carrying around something like a Bag of Holding then the Ranger would have to go far away in order to effectively search for portals.
The following assumes Detect Portal will find Bags of Holding and addresses when it will actually do so:
Thanks to user @Andrew Biggins for finding this question "Does Portal Lore detect currently inactive portals?", the answer there explains that Detect Portal makes no requirement that the portals themselves be currently active. Thus it will work on portals even when they are no longer active.
One odd scenario is when the bag is placed into another extra-dimensional space:
Placing a bag of holding inside an extradimensional space created by a Handy Haversack, Portable Hole, or similar item instantly destroys both items and opens a gate to the Astral Plane. The gate originates where the one item was placed inside the other. Any creature within 10 feet of the gate is sucked through it to a random location on the Astral Plane. The gate then closes. The gate is one-way only and can't be reopened.
The gate still connects both locations, it is simply a one-way connection, and so one end of the gate would be detected by Detect Portal, but the other would not.