As other answers have mentioned, advancements in weapons technology made line infantry and cavalry obsolete. In particular, improved accuracy and reload speed of rifles, combined with mass-production techniques, made the main offensive advantage of line formations—volley firing—largely unnecessary, and made cavarly more vulnerable. The invention of the machine gun and the improvement of artillery made the tight groupings of line tactics a liability. Both line infantry and offensive cavalry were (mostly) obsolete by the end of WWI.
So, to keep these formations and tactics relevant, you need to either prevent or nullify these advancements. You say that technology is around the same as our 20th century. That still leaves a pretty broad range of time—the technology in 1901 was vastly different from the technology in 1999. So the simplest way to allow 19th-century tactics in 20th-century society is to make it the early 20th century. While military tactics were already changing at the turn of the century due to the Boer War and other events, small changes in your world's history and technological development would make it plausible that they were still the same.
Unfortunately, having your story in the early 1900's doesn't fit with your desire to have tanks and planes, let alone spaceflight and drones. So, you will need to go a little later. Both computing and rocketry were greatly advanced during (and because of) World War II. The first electronic programmable computer (Colossus) was built in 1943, and the first Turing-complete electronic computer (ENIAC) was made in 1946. The first artificial satellite (Sputnik-1) was put in orbit in 1957, and the first manned spaceflight (Vostok 1) took place in 1961. So, for more advanced computing and spaceflight to be plausible, the rest of the technology in your world should be around the levels of the 1950's or 60's.
By this time, automatic rifles, grenades, mortars, and bombers were commonplace in warfare. As Twelfth's answer states, it is extremely unlikely that a society or world could have the ability to travel to Mars without developing any of these technologies. They must be able to build pretty good rockets, so they should be able to make missiles relatively easily. You cannot reasonably deny your people the weapons advancements that made line infantry tactics or cavalry charges obsolete. If you want to keep them, your only option is to have other technological advancements the reduce or eliminate the advantages given by these weapons. In other words, you need to have the development of armor and other defenses keep up with weapons development. There are two general types of weapons that you will need to address: rapid-fire small arms and long-range explosives.
For defending against small-arms fire, you basically have two options: armor and cover. The use of cover is better suited for smaller groups like squadrons or fireteams, but can be used by larger lines (during the Napoleonic Wars, the Duke of Wellington would often line his armies on the reverse slope of a hill). If you have body armor that can reliably resist small-arms fire, then you can form lines against enemy infantry without worry.
This hypothetical armor would also do a good job of protecting soldiers against fragmentation bombs, grenades, or artillery, but explosive weaponry would still be a problem. To defend against these—artillery and missiles in particular—you will need to use some sort of active protection. Specifically, your armies will need hardkill measures that directly interfere with incoming projectiles, like close-in weapon systems(CIWS) that shoot down enemy missiles. If you can prevent your opponent's missiles and artillery shells from reaching their target, then explosions from those weapons are no longer a threat.
These technologies could be explained in connection with the society's emphasis on computers and space travel. The development of new rockets and spacecraft could lead to the creation of a new composite material that makes for very effective armor. Advanced computers make the detection and tracking abilities of a CIWS possible, as well.
These two defenses can also give you justification for the offensive aspects of your desired tactics. If your ordinary guns can't penetrate your enemy's body armor, your infantry won't keep using them. They will use something more powerful—maybe something like a large-bore shotgun, or even a 4-bore. Shotguns, especially the larger varieties, are less accurate and have shorter effective ranges than rifles. The high recoil associated with their power would also limit the practical firing rate. These two factors bring you back to something similar to 18th- or 19th-century muskets, where formation firing is the best way to inflict casualties. And if battle lines are still in use, flanking cavalry are still useful, too. (Fun fact: shotgun-like pistols called dragons used by cavalry are how dragoons got their name)
If you're going to protect your troops with a CIWS, you'll need to be able to move it. The lightest one that I've been able to find is more than 7,000 pounds, and most seem to be closer to 12,000 pounds. You'll obviously need a vehicle for that. If your enemy is using a similar system, you'll obviously want to destroy that vehicle. But normal anti-tank weapons, like rocket-propelled grenades, won't work because of the CIWS. However, because of the split-second of time the systems need to identify and shoot down a threat, they have a minimum effective range. So you can have your cavalry charge to get within that range, and then attack.
Now, you have infantry fighting in line formation and cavalry charging tanks all within the realm of (mostly) 20th-century technology! You'll still need some handwaving to explain why you don't use heavy machine guns like the Browning .50 Cal to beat the enemy's body armor, or other possibilities. Maybe the armor is even better than that, and all your infantry use rockets? I don't know, but I think this is the best you can do with this setting. You already have bear-people, so I think people could manage the suspension of disbelief required here.