The current legislation is the Abortion Act of 1974 (SFS 1974:595).
This states that up until the end of the eighteenth week of the pregnancy, the choice of an abortion is entirely up to the woman, for any reason whatsoever.
After the 18th, a woman needs a permission from the National Board of Health and Welfare (Socialstyrelsen) to have an abortion.
Permission for these late abortions is usually granted for cases in which the fetus or mother are unhealthy.
Abortion is not allowed if the fetus is viable, which generally means that abortions after the 22nd week are not allowed.
However, abortions after the 22nd week may be allowed in the rare cases where the fetus can not survive outside the womb even if it is carried to term.
The issue is largely settled in Sweden, and the question of the legality of abortion is not a highly controversial political issue.
Consensus in Sweden is in favour of preventing unwanted pregnancies by the use of birth control and the primary goal is not to lower the amount of abortions, but rather the goal is that all children that are born should be wanted.
The number of abortions statistically follows the number of pregnancies. In comparison with the other Nordic countries, Sweden ranks high in number of abortions, and low in number of young parents, while the number of pregnancies in relation to total population is largely the same in all Nordic countries.
Abortlag (1974:595)
https://www.riksdagen.se/sv/dokument-lagar/dokument/svensk-forfattningssamling/abortlag-1974595_sfs-1974-595