How to indent every paragraph, excluding headings?

This is now available natively with the first-line-indent option, as of Typst 0.13, and should be used instead of the previously listed workarounds:

// Use 'all: true' to indent the first paragraph after
// headings and grids as well
#set par(first-line-indent: (amount: 2em, all: true))

= My heading

This is the first paragraph! It is indented too! #lorem(20)

This is the second paragraph! It is also indented. #lorem(20)

See more information at the docs: Paragraph Function – Typst Documentation