You are describing a "space elevator", a concept that has been studied somewhat seriously since the 1950s. Usually it is considered a cable instead of a rigid bar, and you need a counterweight to keep the center of mass in geostationary orbit. The main problem is that for Earth the tensile strength to density ratio needs to be very high, and it looks like only carbon nanotubes can work (and they have various problems). On Mars or the Moon more standard materials would be feasible.
Closer to the solid bar, Tsiolkovsky originally had the idea of a tower (under compression) reaching orbit, inspired by the Eiffel tower. Each layer of the tower needs to support the total weight of the layers above, producing a roughly exponential cross section with a scale set by the compressive strength to density ratio of the material. Unfortunately there are no known materials that produce orbit-reaching towers with footprints smaller than Earth's surface (plus, there is a buckling issue in the upper part), hence the greater interest in tensile space elevators where the thickest section is in orbit, buckling is no issue, and the material ratio can be more favourable.