Yes, the beaches were fairly heavily fortified, with a mixture of passive obstacles and active strongpoints. However, there were variations in density of the obstacles along the invasion beaches.
The obstacles on the beaches took a variety of forms. Most of these were aimed at making it difficult or dangerous for landing craft to make it ashore, rather than at stopping troops moving off the beach. At the simplest, they were just concrete or wooden stakes, planted in the beach at regular intervals to discourage landing craft. Slightly more sophisticated was the Hemmbalk (beam obstacle), developed from the stake in response to experiments with a landing craft captured at Dieppe. This was a stake, held facing towards the sea at an angle by a bipod, and often tipped with an anti-tank mine. By the 1st of June 1944, some 15,500 stakes and 5,000 Hemmbalken had been laid along the Normandy coast. More substantial obstacles came from prewar fortifications in Europe. Element C, also known as Belgian Gates, were steel frameworks intended to block roads, originally built for the Belgian Army. They were pressed into service as anti-boat obstacles. The 'Czech Hedgehog' had been used for a similar role by the Czech military; this was a simple construction of three steel beams, and was often found embedded in concrete along the Normandy beaches. There were also a number of tetrahedral obstacles, made of concrete or steel, produced specifically for beach defence. About 5,000 tetrahedrons, 2,000 Belgian Gates and 16,000 Czech hedghogs had been deployed along the Normandy Coast by the 1st June. Minefields were generally not found on the beaches themselves, as the mines were too easily swept away by the tide. However, there were a number of improvisations that allowed mines to be used. Some anti-tank mines were placed on wooden floats or rafts offshore. In cliffy areas, like those of Omaha Beach, a number of mines were improvised using artillery rounds fitted with impact fuzes. If the shell was disturbed, or if the rope anchoring it was cut, it would fall to the base of the cliff and detonate.
The average density of obstacles on a beach in Normandy was about 260 per kilometer of beach. However, as the planned invasion beaches were more obvious targets due to their geographical conditions - the slope of the beach, the conditions offshore, the quality of the beach and the soil beneath it, the number of exits and their proximity to valuable targets - they were typically more fortified than average. Sword Beach was the least fortified, due to a rocky shoreline that made emplacing stakes slow going. On sandy beaches, fire hoses could be used to quickly dig a hole for the stake, but on Sword, pneumatic drills had to be used, slowing things down. This meant that Sword had ~300 obstacles per km of beach. Omaha had the densest fortifications, with 490 per km.
The defences extended beyond the beaches, to the exits from the beaches. These had to stop infantry and tanks, not small craft like the beach obstacles. As such, they took more varied forms than the beach obstacles. Thick carpets of barbed-wire were common, as were minefields. By the 6th June, some 4 million mines had been laid along the whole French coast, though only a fraction of this number was along the invasion coast. A lot of effort was put into stopping tanks moving off the beaches. Anti-tank ditches were dug; these were deep, wide ditches with steep sides that tanks could not cross either by going over the top or through. Anti-tank walls were erected, walls too tall and steep for a tank to cross. A number of pre-fabricated steel obstacles were used for a similar effect. Tetrahedrons, Czech Hedgehogs and Belgian Gates could also be found on the beach exits, helping to stop or slow tanks.
The passive obstacles were backed up by strongpoints, dug into the beaches at frequent intervals. These strongpoints, given the German name of Widerstandsnester or 'resistance nests' were designed to give mutal, overlapping fields of fire over likely landing spots and beach exits. They varied along the invasion coast. Those defending the American beaches, in the more rural west, were typically newly-built concrete structures. Those along the British beaches, in the more built-up areas of the east, were often dug into existing buildings or sea walls.
The typical strongpoint might have five machine-gun or mortar emplacements, two or three anti-tank guns in bunkers, and a couple of bunkers as command points or shelters. The typical machine-gun position was called a 'Tobruk', as they were based on one that had been commonly used in defence of the eponymous North African port. The Tobruk was a small concrete bunker, buried in the ground, with a circular opening in the roof for a machine gun or mortar. It gave protection from fire from the ground, while the crew could duck inside if under artillery or mortar fire. Some Tobruks were given turrets from obsolete French tanks, ugrading their firepower and protection slightly. Anti-tank guns were typically placed to fire in 'enfilade', firing along the beach rather than down it, towards the sea. This meant that a thick layer of concrete could be placed on the seaward side of the gun, making the bunker essentially impervious to naval bombardment. To destroy the bunker, the landed troops would have to get around its flanks and fire directly into the embrasure (the opening for the gun), or through the entry door. These bunkers mounted a range of weapons, from 88mm heavy anti-tank guns to captured 75-76mm (French or Russian, respectively) guns and obsolete 50mm AT guns. Most of the 50mm guns were, however, mounted on pedestal mounts in open positions. These were sited to fire on the beaches to destroy oncoming boats. Most beaches covered an area protected by 3-4 strongpoints, though Sword had just two and Omaha had ten.
There were other defences further inland. Artillery pieces were dug in, ready to fire on the invasion beaches or to engage ships offshore. These ranged from captured French, Czech or Russian artillery pieces in open gun pits to naval gun batteries on rotating mounts dug into concrete bunkers. In some areas, there were bunkers inland of the beaches. These were typically command and control positions for the beach defences or for the artillery positions, but could still fight. There were also anti-paratrooper defences. Likely landing fields were filled with stakes to catch gliders, and some also received minefields. Tidal areas were flooded; this also helped to constrain Allied movements off the beaches.
As to how the Allies fought their way through the fortified zone and off the beaches, it was a fairly involved process; I will only cover the British (and Canadian) part of it, and leave the American side to another. Part of the job was simplified by the choice of landing time. Most of the obstacles on the beaches had been placed to catch boats landing at high tide. A high tide landing meant that the troops would have to cover the shortest distance on the beach under fire from the fortifications. Landing at low tide exposed the troops to more risk, but meant that the troops were much more likely to actually make it to the beach without their landing craft sinking under them.
Another factor making the assault easier was the pre-invasion bombardment. This started well before the landings, with bomber raids targeting the heavy gun batteries along the French coast. While these were relatively low intensity, to avoid tipping off the Germans as to where the assault was to come, they did force the evacuation or moving of several gun batteries. As the invasion drew closer, the intensity stepped up. The night of the 5th-6th June saw over 5,000 tons of bombs, dropped by over 1,000 British bombers. More bombers, mostly American medium and heavy bombers, were tasked with hitting the beach defences in the early hours of the morning of the 6th. Following this bombing, which was of limited accuracy, came the naval bombardment.