Mr Kaczynski recalled the Katyn massacre in which 20,000 Polish officers were killed by Soviet forces, saying it was an act of chauvinism and in revenge for Polish independence.
But he also praised the Soviet Union's sacrifice against Nazi Germany.
Speaking at the ceremony on Westerplatte peninsula, Mr Putin highlighted that nearly half of the estimated 50 million people who died during the war were from the Soviet Union.
The Russian prime minister said all pacts that European states agreed with Nazi Germany were "morally unacceptable", including the 1939 Soviet accord.
He added that Russia accepted its mistakes of the past.
Differing historical interpretations of events at the start of the war though have caused a strain in relations between Poland and Russia.
Turning his attention to that controversy, Mr Putin said: "We seriously hope that Russian and Polish relationships will rid themselves of the layers of the past."
Earlier, a dawn ceremony had marked the time when a German battleship fired the first shots on a Polish fort in 1939.
Putin strikes conciliatory note with Poland
The day began with Mr Kaczynski and his Prime Minister Donald Tusk joining war veterans beside a monument to the heroes of Westerplatte at 0445 (0245 GMT).
The ceremony marked the exact time on 1 September 1939 when the German battleship Schleswig-Holstein opened fire at point-blank range on the fort.
At the same time, the German Wehrmacht invaded Poland from east, west and south. The attacks triggered Britain and France's declaration of war against Germany two days later.
Just two weeks later, in mid-September 1939, the Soviet armies occupied eastern Poland.
Speaking at the dawn ceremony, Mr Kaczynski said: "On 17 September... Poland received a stab in the back... This blow came from Bolshevik Russia."
He added: "Glory to the heroes of Westerplatte, glory to all of the soldiers who fought in World War II against German Nazism, and against Bolshevik totalitarianism."
In his address, Mr Tusk said the lessons of history should not be forgotten.
"We remember because we know well that he who forgets, or he who falsifies history, and has power or will assume power will bring unhappiness again like 70 years ago," he said.
At the time of the attack by the Schleswig-Holstein - which was moored in the Polish harbour on a friendship visit - Gdansk was known as the free city of Danzig.
The 182 Polish troops defending the Polish fort were expected to resist for about 12 hours. Despite coming under fire from the air, sea and land, they held out against a force of more than 3,000 Germans for seven days.
According to a survey published on Monday, Westerplatte is the most important symbol of Polish resistance in the whole of the war.
Two weeks after the German invasion, the Red Army invaded and annexed eastern Poland under terms agreed in the secret protocol of a Nazi-Soviet pact.
In early 1940, the Soviet secret services murdered more than 20,000 Polish officers in the forests around Katyn. For 50 years Moscow blamed the Nazis and only admitted responsibility for the crime in 1990.
Russian courts have ruled that Katyn cannot be considered a war crime and Moscow is still refusing to declassify documents about the massacre.
The temperature was raised further this week with accusations broadcast on Russian state TV which implied the USSR was justified in its invasion of Poland because Warsaw had been conspiring with Hitler against Moscow.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.